File: InvariantArrays.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 (53 lines) | stat: -rw-r--r-- 1,529 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
import java.util.LinkedList;
import java.util.List;
import testlib.util.*;

class InvariantArrays {
    Object[] oa;
    @Encrypted Object[] eoa;

    String[] sa;
    @Encrypted String[] esa;

    void tests() {
        // TODOINVARR:: error: (assignment.type.incompatible)
        oa = eoa;
        // This error only occurs with the Encrypted type system;
        // other type systems don't suffer an error here.
        // :: error: (assignment.type.incompatible)
        eoa = oa;
        // TODOINVARR:: error: (assignment.type.incompatible)
        oa = esa;
        // OK
        oa = sa;
        eoa = esa;
    }

    List<? extends Object>[] loa;
    LinkedList<? extends Runnable>[] llra;
    List<? extends @Encrypted Object>[] leoa;
    LinkedList<? extends @Encrypted Runnable>[] llera;
    @Encrypted List<? extends Object>[] eloa;
    @Encrypted LinkedList<? extends Runnable>[] ellra;
    @Encrypted List<? extends @Encrypted Object>[] eleoa;
    @Encrypted LinkedList<? extends @Encrypted Runnable>[] ellera;

    void genericTests() {
        // OK
        loa = llra;
        loa = leoa;
        loa = llera;
        eloa = ellra;
        leoa = llera;
        eloa = ellera;

        // TODOINVARR:: error: (assignment.type.incompatible)
        loa = eloa;
        // TODOINVARR:: error: (assignment.type.incompatible)
        loa = ellra;
        // :: error: (assignment.type.incompatible)
        eleoa = eloa;
        // TODOINVARR:: error: (assignment.type.incompatible)
        leoa = eleoa;
    }
}