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

Missing check for library models for lambdas with an expression body #910

Open
msridhar opened this issue Feb 14, 2024 · 0 comments
Open

Comments

@msridhar
Copy link
Collaborator

msridhar commented Feb 14, 2024

In our handling of lambdas, we immediately bail out of all checking if the corresponding functional interface method is unannotated:

if (codeAnnotationInfo.isSymbolUnannotated(funcInterfaceMethod, config, handler)) {
return Description.NO_MATCH;
}

But, this skips a check that is later performed for return types, where we allow library models to override return type nullability:

return handler.onOverrideMethodReturnNullability(
methodSymbol, state, isMethodAnnotated, methodReturnNullness);
}

In particular, we model Guava Functions as having a @NonNull return, but if you write (x) -> null and pass it as a Guava Function currently NullAway does not report an error. In contrast, writing (x) -> { return null; } yields an error. This should be relatively easy to fix, but it will lead to new errors when users do a NullAway update.

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

1 participant