1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 8237072
 4  * @summary Test various relationships between a value type and its reference projection.
 5  * @compile/fail/ref=GenericInlineTest.out -XDrawDiagnostics GenericInlineTest.java
 6  */
 7 
 8 abstract class Low<T, U> {}
 9 abstract class Mid<T, U> extends Low<U, T> {}
10 abstract class High<T, U> extends Mid<U, T> {}
11 
12 primitive
13 class GenericInlineTest.val<T, U> extends High<U, T> {
14 
15     int x = 0;
16 
17     void foo() {
18 
19         GenericInlineTest.val<String, Integer> g = new GenericInlineTest<String, Integer>();
20 
21         High<String, Integer> h1 = g; // error.
22 
23         High<Integer, String> h2 = g; // Ok.
24 
25         Mid<String, Integer> m1 = g; // Ok
26 
27         Mid<Integer, String> m2 = g; // error.
28 
29         Low<String, Integer> l1 = g; // error.
30 
31         Low<Integer, String> l2 = g; // Ok.
32 
33         g = l2; // error.
34         g = (GenericInlineTest.val<String, Integer>) l2; // OK.
35 
36         GenericInlineTest<String, Integer> r1 = g; // ok.
37         GenericInlineTest.ref<Integer, String> r2 = g; // error
38 
39         g = r1; // ok.
40         g = r2; // error.
41         g = (GenericInlineTest.val<String, Integer>) r2; // still error.
42 
43     }
44 }