We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Null pointer de-reference checks do not appear to be working within Java 8 lambdas.
Anonymous classes work fine but converting these to lambdas effectively suppresses any warnings.
See below for an example test case:
package sfBugsNew; import javax.annotation.CheckForNull; import edu.umd.cs.findbugs.annotations.ExpectWarning; /** */ public class Bug { /** * @return may be null */ @CheckForNull public static String methodThatMightReturnNull() { if (Boolean.getBoolean("test")) { return null; } return "test"; } /** */ @ExpectWarning("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") public void testNPLambda() { Runnable lambda = () -> { String maybeNull = methodThatMightReturnNull(); // would expect findbugs warning about possible null dereferencing here boolean empty = maybeNull.isEmpty(); System.out.println(empty); }; lambda.run(); } }
The text was updated successfully, but these errors were encountered:
@lotsabackscatter this one is fixed on master branch of Spotbugs, will be included in the next release (3.1.0).
Thanks for the report.
Sorry, something went wrong.
This project continues development in a new home: https://github.com/spotbugs/spotbugs/
No branches or pull requests
Null pointer de-reference checks do not appear to be working within Java 8 lambdas.
Anonymous classes work fine but converting these to lambdas effectively suppresses any warnings.
See below for an example test case:
The text was updated successfully, but these errors were encountered: