File: WhileTest.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 (63 lines) | stat: -rw-r--r-- 1,288 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;

public class WhileTest {
    @Nullable Integer z;
    @NonNull Integer nnz = Integer.valueOf(22);

    public static void main(String[] args) {
        new WhileTest().testwhile1();
    }

    public void testwhile1() {
        z = null;
        // :: error: (assignment.type.incompatible)
        nnz = z;

        while (z == null) {
            break;
        }
        // :: error: (assignment.type.incompatible)
        nnz = z;
        nnz.toString();
    }

    public void testwhile2() {
        z = null;
        while (z == null) {;
        }
        nnz = z;
    }

    public void testdo1() {
        z = null;
        do {
            break;
        } while (z == null);
        // :: error: (assignment.type.incompatible)
        nnz = z;
    }

    public void testdo2() {
        z = null;
        do {;
        } while (z == null);
        nnz = z;
    }

    public void testfor1() {
        z = null;
        for (; z == null; ) {
            break;
        }
        // :: error: (assignment.type.incompatible)
        nnz = z;
    }

    public void testfor2() {
        z = null;
        for (; z == null; ) {;
        }
        nnz = z;
    }
}