Community
Participate
Working Groups
3.3, JDK 1.6 // [case 1] the following does not compile B b= new B() { @Override protected <S extends D> C<S> createC(Class<S> type) { return null; } }; // [case 2] the following does compile // the only difference is that B2 is not abstract B2 b2= new B2() { @Override protected <S extends D> C<S> createC(Class<S> type) { return null; } }; I'll attach a test project demonstrating the problem. I don't now the spec. Thus, the question is whether case 1 should compile fine or case 2 should also indicate an error somewhere. Note, the test case was reproduced from an open source project which uses the Sun compiler. Case 1 seems to compile without a problem there.
Created attachment 73299 [details] test project demonstrating the problem
Likely related to bug 195468. This problem also existed in 3.2.2. Simplified testcase is : class A<T> { void get(T t) {} } abstract class B extends A<C> { <S> void get(C<S> c) {} } class B2 extends A<C> { <S> void get(C<S> c) {} } class AbstractB extends B {} class NonBugB extends B2 {} class C<T> {}
(In reply to comment #2) > Likely related to bug 195468. Yes, looks like a dup. Note that there are another compile errors reported when you call the method in later code (ambiguous reference).
Added MethodVerifyTest test146 Released into HEAD for 3.4M1 Released for 3.3.1
fixed & released into both streams
Verified for 3.4M1 using build I20070802-0800.
+1 for 3.3.1
Verified for 3.3.1 using build M20070831-2000.
For posterity: during work on bug 410325 the test from this bug re-appeared. The original solution could no longer be recognized in the code, due to lots of changes in MethodVerifier15. Hence, bug 410325 implements a new special case check in checkInheritedMethods() to re-fix this bug.