Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize on sneakyThrow for "impossible" checked exceptions. #7579

Merged
merged 1 commit into from
Dec 27, 2024

Conversation

copybara-service[bot]
Copy link
Contributor

Standardize on sneakyThrow for "impossible" checked exceptions.

This makes our code behave the same for sneaky checked exceptions that occur when our implementations use reflection as for those that occur when our implementations use direct calls.

This shouldn't matter for any of the code that I'm migrating to sneakyThrow in this CL, but there are other cases in which it could matter, and we're probably best off standardizing on one approach, just as we've done for catching sneaky checked exceptions.

Plus, pull each package's sneakyThrow out into its own top-level class for reuse.

Also, sneak in a few other tiny cleanups:

  • We don't normally use @GwtCompatible in Truth, so remove it from J2ktIncompatible.
  • We can now use Primitives.wrap to produce a better error message for isIntanceOf(primitiveType).

RELNOTES=n/a

This makes our code behave the same for sneaky checked exceptions that occur _when our implementations use reflection_ as for those that occur when our implementations use direct calls.

This shouldn't matter for any of the code that I'm migrating to `sneakyThrow` in this CL, but there are other cases in which it could matter, and we're probably best off standardizing on one approach, just as we've done for _catching_ sneaky checked exceptions.

Plus, pull each package's `sneakyThrow` out into its own top-level class for reuse.

Also, sneak in a few other tiny cleanups:

- We don't normally use `@GwtCompatible` in Truth, so remove it from `J2ktIncompatible`.
- We can now use `Primitives.wrap` to produce a better error message for `isIntanceOf(primitiveType)`.

RELNOTES=n/a
PiperOrigin-RevId: 710111747
@copybara-service copybara-service bot merged commit 1462a03 into master Dec 27, 2024
@copybara-service copybara-service bot deleted the test_710060382 branch December 27, 2024 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant