IDEA-175840 @NotNull generated code: wrong parameter is checked for null-value

This commit is contained in:
peter
2017-08-14 16:11:54 +02:00
parent 0aa2d4abc7
commit 879e9ed76d
3 changed files with 85 additions and 11 deletions
@@ -0,0 +1,47 @@
import java.lang.annotation.*;
@Target({ElementType.TYPE_USE, ElementType.PARAMETER})
@interface NotNull {}
public class LocalClassImplicitParameters {
private void foo(String foo, final Integer bar) {
class Test {
private Test(@NotNull String test) {
if (test == null) {
System.out.println(bar);
}
}
}
new Test(foo);
}
public int ok() {
foo("a", 2);
return 42;
}
public void failLocal() {
foo(null, null);
}
public void failAnonymous() {
new _Super("a") {
void method(@NotNull java.util.List<?> test){}
}.method(null);
}
public void failInner() {
new Inner(null, "b");
}
private class Inner {
Inner(@NotNull String param, @NotNull String param2) {
}
}
}
class _Super {
_Super(@NotNull String f) {}
}