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
IndexOutOfBoundsException in NullAway.java #290
Comments
Note that the example ( and |
Possibly relevant - that API has two parameters - both are the same type, but the second is varag.
In this case, only |
Looking at the code, I think it's this :) NullAway/nullaway/src/main/java/com/uber/nullaway/NullAway.java Lines 1262 to 1265 in 31a1842
|
Thanks, @ZacSweers. I won't have time to look at this for the next few days, but hopefully @lazaroclapp can help. |
Resolves #290 by supporting vararg nullability. Previously, we ignored the default nullability info of vararg arguments, but would error out if the vararg formal was deemed non-null by a handler. Instead, we now correctly acknowledge the nullability of vararg arguments whether they are non-null due to default code assumptions or due to handlers (restrictive annotations, `@Contract`, etc). This PR also adds tests and support for `javax.annotations.Nonnull` which we were ignoring before and is needed for those tests.
Indeed it is related. That check was fine, actually (as long as you are ok with ignoring nullability of varargs to avoid the crash), the problem is that there is an else-branch for nullability coming from handlers (e.g. from explicit Could have just added it to both sides of the branch, but I'd rather just support varargs the right way: #291 ;) @msridhar Any chance you can give that PR a 5-min sanity review? |
Resolves #290 by supporting vararg nullability. Previously, we ignored the default nullability info of vararg arguments, but would error out if the vararg formal was deemed non-null by a handler. Instead, we now correctly acknowledge the nullability of vararg arguments whether they are non-null due to default code assumptions or due to handlers (restrictive annotations, `@Contract`, etc). This PR also adds tests and support for `javax.annotations.Nonnull` which we were ignoring before and is needed for those tests.
Resolves #290 by supporting vararg nullability. Previously, we ignored the default nullability info of vararg arguments, but would error out if the vararg formal was deemed non-null by a handler. Instead, we now correctly acknowledge the non-null status of vararg arguments whether they are non-null due to default code assumptions or due to handlers (restrictive annotations, `@Contract`, etc). Note that we don't actually support checking methods taking `@Nullable` var args (e.g. we don't support `@Nullable` var args in methods defined in annotated code). Supporting that would require supporting nullability in generics/array elements, which NullAway currently punts on. Instead, we print a corresponding error in this case. This PR also adds tests and support for `javax.annotations.Nonnull` which we were ignoring before and is needed for those tests.
Appears to be coming from here:
NullAway/nullaway/src/main/java/com/uber/nullaway/NullAway.java
Line 1289 in 31a1842
I've filed a more detailed version with a repro diff internally with @lazaroclapp, but filing here for visibility as well
The text was updated successfully, but these errors were encountered: