Debian Codegraph @

checker/tests/nullness/java8/methodref/Postconditions.java

raw
1 // Test case for Issue #801
2 // https://github.com/typetools/checker-framework/issues/801
3 // @skip-test
4 // TODO: Enable postcondition override checks for method references
5
6 import org.checkerframework.checker.nullness.qual.*;
7
8 interface AssertFunc {
9 @EnsuresNonNullIf(result = true, expression = "#1")
10 boolean testParam(final @Nullable Object param);
11 }
12
13 interface AssertFunc2 {
14 @EnsuresNonNullIf(result = true, expression = "#1")
15 boolean testParam(final @Nullable Object param);
16 }
17
18 class AssertionTest {
19 @EnsuresNonNullIf(result = true, expression = "#1")
20 static boolean override(final @Nullable Object param) {
21 return param != null;
22 }
23
24 static boolean overrideAssertFunc2(final @Nullable Object param) {
25 return param != null;
26 }
27
28 void context() {
29 AssertFunc f = AssertionTest::override;
30 // :: error: (methodref.receiver.postcondition)
31 AssertFunc2 f2 = AssertionTest::overrideAssertFunc2;
32 }
33 }