File: Issue2809.java

package info (click to toggle)
checker-framework-java 3.2.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 22,840 kB
  • sloc: java: 145,910; xml: 839; sh: 518; makefile: 401; perl: 26
file content (31 lines) | stat: -rw-r--r-- 853 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
// test cases for #2809
// https://github.com/typetools/checker-framework/issues/2809

import org.checkerframework.checker.interning.qual.Interned;
import org.checkerframework.checker.interning.qual.UnknownInterned;

class Issue2809 {

    void new1(MyType<int @Interned []> t, int @Interned [] non) {
        t.self(new MyType<>(non));
    }

    void new2(MyType<int @Interned []> t, int @Interned [] non) {
        t.self(new MyType<int @Interned []>(non));
    }

    void new3(MyType<@Interned MyType<Object>> t, @Interned MyType<Object> non) {
        t.self(new MyType<>(non));
    }

    void newFail(MyType<int @Interned []> t, int @UnknownInterned [] non) {
        // :: error: (argument.type.incompatible)
        t.self(new MyType<>(non));
    }

    class MyType<T> {
        MyType(T p) {}

        void self(MyType<T> myType) {}
    }
}