1/*
2 * @test /nodynamiccopyright/
3 * @bug 8043893
4 * @summary Inference doesn't report error on incompatible upper bounds
5 *
6 * @compile -source 7 T8043893.java
7 * @compile/fail/ref=T8043893.out -Xlint:-options -XDrawDiagnostics -source 8 T8043893.java
8 */
9
10class T8043893<X> {
11
12    interface S1<U> { }
13
14    interface S2<U> { }
15
16    interface T0 { }
17
18    interface T1 extends S1<Number>, S2<Number> { }
19
20    interface T2 extends S1<Integer>, S2<Integer> { }
21
22    interface T3 extends S1<Number>, S2<Integer> { }
23
24    interface T4 extends S1<Number> { }
25
26    interface T5 extends S1<Integer> { }
27
28    <Z extends T1> void m_intersection(T8043893<? super Z> a) { }
29
30    <Z extends T4> void m_class(T8043893<? super Z> a) { }
31
32    void test() {
33        //intersection type checks
34        m_intersection(new T8043893<T1>()); //ok in both 7 and 8 - Z = T1
35        m_intersection(new T8043893<T2>()); //ok in 7, fails in 8
36        m_intersection(new T8043893<T3>()); //ok in 7, fails in 8
37        m_intersection(new T8043893<T0>()); //ok in both 7 and 8 - Z = T0 & T1
38        //class type checks
39        m_class(new T8043893<T4>()); //ok in both 7 and 8 - Z = T4
40        m_class(new T8043893<T5>()); //ok in 7, fails in 8
41        m_class(new T8043893<T0>()); //ok in both 7 and 8 - Z = T0 & T4
42    }
43}
44