Skip to content

Should we have a code check for ObjectHelper.requireNonNull on a primitive? #6013

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

Closed
jnlopar opened this issue May 22, 2018 · 1 comment
Closed

Comments

@jnlopar
Copy link
Contributor

jnlopar commented May 22, 2018

I found a couple small instances of ObjectHelper.requireNonNull being used on primitive ints, which I patched in #6012 . Does the Rx codebase have a code pattern checking framework that we could augment to find other potential instances of this that could be causing unnecessary boxing? Errorprone, for example, has this check: https://errorprone.info/bugpattern/PreconditionsCheckNotNullPrimitive for a similar pattern on Guava's Preconditions.checkNotNull, so having one for ObjectHelper could be potentially useful here.

@akarnokd
Copy link
Member

You could create trap overloads that always throw then see if something does crash or shows up as dependency on that method.

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

No branches or pull requests

2 participants