dfa: inspect enum constant methods (IDEA-142299)

This commit is contained in:
peter
2015-07-10 20:38:54 +02:00
parent 83b5a41c82
commit 99f343707f
3 changed files with 53 additions and 1 deletions
@@ -0,0 +1,37 @@
package foo;
import javax.annotation.*;
enum TestNonnull {
TEST {
@Nonnull
@Override
public Object testWithAnnotation(@Nonnull Object aObject) {
if (<warning descr="Condition 'aObject == null' is always 'false'">aObject == null</warning>) {
return new Object();
}
return <warning descr="'null' is returned by the method declared as @NotNull">null</warning>;
}
@Override
public Object testWithoutAnnotation(Object aObject) {
return <warning descr="'null' is returned by the method declared as @NotNull">null</warning>;
}
};
public boolean testParameter(TestNonnull aTest) {
if (<warning descr="Condition 'aTest == null' is always 'false'">aTest == null</warning>) {
return true;
}
return false;
}
public Object testReturn() {
return <warning descr="'null' is returned by the method declared as @NotNull">null</warning>;
}
@Nonnull
public abstract Object testWithAnnotation(@Nonnull Object aObject);
public abstract Object testWithoutAnnotation(Object aObject);
}