File: Issue1120.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,104 kB
  • sloc: java: 145,916; xml: 839; sh: 518; makefile: 404; perl: 26
file content (35 lines) | stat: -rw-r--r-- 803 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Test case for Issue #1120:
// https://github.com/typetools/checker-framework/issues/1120

import org.checkerframework.checker.initialization.qual.UnknownInitialization;

class Issue1120Super {
    Object f = new Object();
}

final class Issue1120Sub extends Issue1120Super {
    Object g;

    Issue1120Sub() {
        this.party();
        // this is @UnderInitialization(A.class)
        g = new Object();
        // this is @Initialized now
        this.party();
        this.bar();
    }

    Issue1120Sub(int i) {
        // this is @UnderInitialization(A.class)
        this.party();
        // :: error: (method.invocation.invalid)
        this.bar();
        g = new Object();
    }

    void bar() {
        g.toString();
    }

    void party(@UnknownInitialization Issue1120Sub this) {}
}