Hello all,
The following code gives me a "NullPointerException" will be thrown when invoking method "m2()". It looks like passing x to m1 makes the analyser believe that x is nullable, just because the parameter is marked @CheckForNull. However, the @Nonnull in m0 should have made it clear that that is not the case.
I don't think a parameter annotation should be used to say something about the actual argument in this case.
package nl.donna.pm.planversiekern.dto.muteer.mutator;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
public class UnexpectedNpeIssue {
void m0(@Nonnull String x) {
m1(x);
m2(x);
}
private void m1(@CheckForNull String x) {
}
private void m2(String x) {
x.toString();
}
}
Thanks,
Danny