Community
Participate
Working Groups
For following code used to compile with javac 1.6, but no longer compile using javac 1.7. This would mean that we need to use the compliance if we want to mimic the javac 1.6 behavior. class A<T> {} interface I { void foo(A<Number> p); } interface J extends I { void foo(A<Integer> p); } It looks like in org.eclipse.jdt.internal.compiler.lookup.MethodVerifier15.checkForNameClash(MethodBinding, MethodBinding) that the name clash check is not done for interfaces. Such interface could only be implemented using a raw type for the parameter type. The JLS needs to be checked regarding to this issue, but the current JDK7 build (b124) is already implementing the change. Same thing applies to static methods: class A<T> {} class Super { void foo(A<Number> p) {} } class Sub extends Super { void foo(A<Integer> p) {} } This code compiles using javac 1.6, but doesn't compile anymore using javac 1.7.
Srikanth, please investigate.
Created attachment 186774 [details] Proposed fix This seems to do the trick. Of course some existing tests are now failing in compliance 1.7. I'll attach all the test failures in compliance 1.7.
Created attachment 186775 [details] All compiler test failures in compliance 1.7.
*** Bug 345625 has been marked as a duplicate of this bug. ***
With the current patch, the following triggers an error while javac7 compiles it fine: interface I<E> { I<String> b(); } interface J<E> extends I<E> { <U> J<String> b(); } Needs to be investigated. Also see https://bugs.eclipse.org/bugs/show_bug.cgi?id=322740.
Slightly simpler case: interface I { I b(); } interface J extends I { J b(); } compiles alright, while interface I { I b(); } interface J extends I { <U> J b(); } reports a name clash, javac7 compiles both alright.
*** Bug 322740 has been marked as a duplicate of this bug. ***
This issue has many intertwined nuances to it. In order to preserve my sanity I'll split the issues into different bugs. I'll keep the current one for the interface name clash case and raise a separate one for the static method case and yet another for the cases reported in comment# 6
(In reply to comment #6) The Equivalent class case (abstract and concrete both) fail too. Raised bug 345947 to track this issue as it is unrelated to the current problem. >(In reply to comment #0) > Same thing applies to static methods: [...] > This code compiles using javac 1.6, but doesn't compile anymore using javac > 1.7. Raised bug 345949 to track this case.
Created attachment 195734 [details] Proposed fix + tests This fixes the interface method name clash case. Also includes a junit test case for bug 322740.
Fix applies for all compliance levels. But the fix is released only in BETA_JAVA7 branch and will be seen by users only via a JDK7 compatible release from Eclipse.
*** Bug 342819 has been marked as a duplicate of this bug. ***
Verified using Eclipse Java 7 Support(Beta) feature patch v20110623-0900.