Summary: | Eclipse compiler allows access to private fields for typed variables | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Kasper Nielsen <news> | ||||||
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | amj87.iitr, jarthana, pwebster, sven.koehler | ||||||
Version: | 3.7 | ||||||||
Target Milestone: | 3.7 M6 | ||||||||
Hardware: | All | ||||||||
OS: | Windows 7 | ||||||||
See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=511624 | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Kasper Nielsen
2011-01-18 06:09:27 EST
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. *** *** Bug 362969 has been marked as a duplicate of this bug. *** |