Debian Codegraph @

checker/tests/nullness/init/InstanceOf.java

raw
1 // Test case for pull request 735
2 // https://github.com/typetools/checker-framework/pull/735
3
4 import org.checkerframework.checker.initialization.qual.UnknownInitialization;
5
6 class PptTopLevel {
7 class Ppt {
8 Object method() {
9 return "";
10 }
11 }
12
13 class OtherPpt extends Ppt {}
14 }
15
16 class InstanceOf {
17 void foo(PptTopLevel.@UnknownInitialization(PptTopLevel.class) Ppt ppt) {
18 // :: error: (method.invocation.invalid)
19 ppt.method();
20 if (ppt instanceof PptTopLevel.OtherPpt) {
21 PptTopLevel.OtherPpt pslice = (PptTopLevel.OtherPpt) ppt;
22 // :: error: (method.invocation.invalid)
23 String samp_str = " s" + pslice.method();
24 }
25 }
26 }