File: T8043893.java

package info (click to toggle)
libnb-javaparser-java 9%2B2018-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 65,320 kB
  • sloc: java: 440,096; xml: 6,359; sh: 865; makefile: 314
file content (43 lines) | stat: -rw-r--r-- 1,294 bytes parent folder | download | duplicates (9)
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
/*
 * @test /nodynamiccopyright/
 * @bug 8043893
 * @summary Inference doesn't report error on incompatible upper bounds
 *
 * @compile -source 7 T8043893.java
 * @compile/fail/ref=T8043893.out -Xlint:-options -XDrawDiagnostics -source 8 T8043893.java
 */

class T8043893<X> {

    interface S1<U> { }

    interface S2<U> { }

    interface T0 { }

    interface T1 extends S1<Number>, S2<Number> { }

    interface T2 extends S1<Integer>, S2<Integer> { }

    interface T3 extends S1<Number>, S2<Integer> { }

    interface T4 extends S1<Number> { }

    interface T5 extends S1<Integer> { }

    <Z extends T1> void m_intersection(T8043893<? super Z> a) { }

    <Z extends T4> void m_class(T8043893<? super Z> a) { }

    void test() {
        //intersection type checks
        m_intersection(new T8043893<T1>()); //ok in both 7 and 8 - Z = T1
        m_intersection(new T8043893<T2>()); //ok in 7, fails in 8
        m_intersection(new T8043893<T3>()); //ok in 7, fails in 8
        m_intersection(new T8043893<T0>()); //ok in both 7 and 8 - Z = T0 & T1
        //class type checks
        m_class(new T8043893<T4>()); //ok in both 7 and 8 - Z = T4
        m_class(new T8043893<T5>()); //ok in 7, fails in 8
        m_class(new T8043893<T0>()); //ok in both 7 and 8 - Z = T0 & T4
    }
}