1/* 2 * @test /nodynamiccopyright/ 3 * @bug 6227936 4 * @summary Wrong type of inherited method using specialized type parameter 5 * @compile/fail/ref=Orig.out -XDrawDiagnostics Orig.java 6 */ 7 8class GenericTest { 9 static class A<T extends B> { 10 T myB; 11 A(T myB) {this.myB = myB;} 12 T getB() {return myB;} 13 } 14 static class B<T extends C> { 15 T myC; 16 B(T myB) {this.myC = myC;} 17 T getC() {return myC;} 18 } 19 static class C { 20 C() {} 21 } 22 23 static class A1<T extends B1> extends A<T> { 24 A1(T myB) {super(myB);} 25 public void testMethod() { 26 // This next line fails, but should work 27 getB().getC().someMethod(); 28 ((C1)getB().getC()).someMethod(); 29 } 30 } 31 static class B1<T extends C1> extends B<T> { 32 B1(T myC) {super(myC);} 33 } 34 static class C1 extends C { 35 public void someMethod() {} 36 } 37} 38