File: AnonymousClasses.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 (22 lines) | stat: -rw-r--r-- 715 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
import java.util.Comparator;
import testchecker.quals.H1S1;
import testchecker.quals.H1S2;

class AnonymousClasses {
    private <@H1S1 T extends @H1S1 Comparator<T>> void testGenericAnonymous() {
        // :: error: (type.argument.type.incompatible) :: error: (constructor.invocation.invalid)
        new @H1S1 Gen<T>() {};
        // :: error: (type.argument.type.incompatible) :: warning:
        // (cast.unsafe.constructor.invocation)
        new @H1S1 GenInter<T>() {};
    }
}

class Gen<@H1S2 F extends @H1S2 Object> {
    // :: error: (super.invocation.invalid) :: warning: (inconsistent.constructor.type)
    public @H1S2 Gen() {}
}

interface GenInter<@H1S2 F extends @H1S2 Object> {}

interface Foo {}