Compillation Java 8 to 8 bytecode - no issues
Compilation Java 11 to 8 bytecode:
@Override
public void processLines(Consumer
try (Stream
lines.forEach(processor);
} catch (IOException | UncheckedIOException e) {
throw new ConfigurationException("Can't open " + pathIncludingBase, e);
}
}
gives us
[ERROR] Nullcheck of lines at line 97 of value previously dereferenced in com.opentable.frontdoor.configuration.ConfigSourceFactoryImpl$ForLocalFile.processLines(Consumer) [com.opentable.frontdoor.configuration.ConfigSourceFactoryImpl$ForLocalFile, com.opentable.frontdoor.configuration.ConfigSourceFactoryImpl$ForLocalFile] At ConfigSourceFactoryImpl.java:[line 97]Redundant null check at ConfigSourceFactoryImpl.java:[line 98] RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
Thanks for opening your first issue here! :smiley:
Please check our contributing guideline. Especially when you report a problem, make sure you share a Minimal, Complete, and Verifiable example to reproduce it in this issue.
3.1.11 spotbugs, 3.1.11 maven spotbugs
Seeing the same when java 11 builds a try-with-resource on my open source project, I get a lot of of those and the lines referenced are not matching the sources, like the redundant check is pointing at the final closing parenthesis of the try-with-resource
I believe this is a duplicate of https://github.com/spotbugs/spotbugs/issues/259.
No that one #259 was originally about a fp with two try usings. This is about with java 11 one try using giving an fp
Here is a minimal project that reproduces the error
https://github.com/jscancella/spotBugsIssue878
@KengoTODA @markkolich any idea what milestone/timeline for fixing this? I can imagine this is going to be showstopper for anyone using try with resources on java 11.
@KengoTODA I tested in my personal project and after setting
spotbugs {
toolVersion = '4.1.3'
}
it fixed the issue for me.
Most helpful comment
@KengoTODA I tested in my personal project and after setting
it fixed the issue for me.