Community
Participate
Working Groups
Build Identifier: 20100917-0705 The Eclipse compiler allows the following to compile. According to JLS section 4.4 this should result in a compile-time exception. http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.4 (Discussion) public class Wtf { private Object foo; public <T extends Wtf> void test(T t) { System.out.println(t.foo); } } Reproducible: Always Steps to Reproduce: Compile the source code
This code compiles fine with java 6, but fails with java 7. Srikanth, please investigate. Thanks!
Changes were made to the the java 7 compiler to bring the compiler in accordance with JLS see: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6558551 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6644562 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6711619
We do handle members with package level access correctly. Also the private member if the package differs.
It looks like the buggy behavior was introduced deliberately to match javac behavior. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=74096. bug 74096 comment 2 is in direct contravention to JLS 4.4. I'll introduce a fix for 1.7 compliance mode, leaving the behavior unchanged (thus matching javac) for 1.5 and 1.6.
Created attachment 188502 [details] Patch under consideration
Created attachment 188509 [details] Revised patch under test - This patch handled private types also in an analogous manner. - Adjusts the existing tests to expect new behavior at >= 1.7 - Under test.
All tests pass. Jay, please review. TIA.
Released in HEAD for 3.7 M6
Verified for 3.7M6 using build I20110301-1537.
*** Bug 362969 has been marked as a duplicate of this bug. ***