It seems, that RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE is still behaving different based on the JDK used in some situations. I expected my problems to be solved with #259, #647, #1248 or #1250, but the latest Spotbugs release didn't solve them.
I'm using Spotbugs 4.1.4 with low threshold via the Maven Spotbugs Plugin 4.1.3 and receive the error message Redundant nullcheck of inputStream, which is known to be non-null in de.larssh.pulls.IssuesSpotbugs.loadKeyStore(Path) [de.larssh.pulls.IssuesSpotbugs] Redundant null check at IssuesSpotbugs.java:[line 10] RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE.
You can find an issue showcase at https://github.com/lars-sh/parent/tree/issues-spotbugs . Just in case the links do not work in future, here's the essential code snippet:
public static KeyStore loadKeyStore(final Path path) throws Exception {
try (InputStream inputStream = Files.newInputStream(path)) {
// final KeyStore keyStore = KeyStore.getInstance("JKS");
// keyStore.load(inputStream, password.toCharArray());
// return keyStore;
return KeyStore.getInstance("JKS");
}
}
The related GitHub Action builds can be found at https://github.com/lars-sh/parent/actions?query=branch%3Aissues-spotbugs . They show, that Spotbugs do not raise a RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE for JDK 8 to 10, but raise one when compiling with JDK 11 and later.
EDIT: Migrated from Travis CI to GitHub Actions
It seems, that RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE is still behaving different based on the JDK used in some situations. I expected my problems to be solved with #259, #647, #1248 or #1250, but the latest Spotbugs release didn't solve them.
I'm using Spotbugs 4.1.4 with low threshold via the Maven Spotbugs Plugin 4.1.3 and receive the error message
Redundant nullcheck of inputStream, which is known to be non-null in de.larssh.pulls.IssuesSpotbugs.loadKeyStore(Path) [de.larssh.pulls.IssuesSpotbugs] Redundant null check at IssuesSpotbugs.java:[line 10] RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE.You can find an issue showcase at https://github.com/lars-sh/parent/tree/issues-spotbugs . Just in case the links do not work in future, here's the essential code snippet:
The related GitHub Action builds can be found at https://github.com/lars-sh/parent/actions?query=branch%3Aissues-spotbugs . They show, that Spotbugs do not raise a RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE for JDK 8 to 10, but raise one when compiling with JDK 11 and later.
EDIT: Migrated from Travis CI to GitHub Actions