Summary: | [compiler] Private superclass and enclosing scope field names incorrectly reported as conflicting | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | vassili | ||||||||
Component: | Core | Assignee: | Srikanth Sankaran <srikanth_sankaran> | ||||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||||
Severity: | normal | ||||||||||
Priority: | P3 | CC: | jarthana, Olivier_Thomann, tparker | ||||||||
Version: | 3.5.2 | ||||||||||
Target Milestone: | 3.7 M1 | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Whiteboard: | |||||||||||
Attachments: |
|
Description
vassili
2010-06-15 14:13:49 EDT
Created attachment 172705 [details]
junit from submitter's report.
This codifies the current behavior and will have to change
suitably as the source code changes.
Created attachment 173410 [details]
Patch under consideration
All tests pass. Jay, please review. Thanks in advance. Patch looks good to me. One observation, though. When I changed the specifier to public in the super class as in the example below, I get the compiler error as mentioned in the comment #0. However, this error doesn't appear if the compiler level is set to >= 1.4. class A { static class B { private int x; public C c = new C() { void foo() { x = 3; // Error only when compiler is set to 1.3 } }; } static class C { public int x; } } Looking at the code, this might be the expected behavior after all. One concern, though, is that javac doesn't report any error at all no matter what -source I set. (In reply to comment #4) > Patch looks good to me. > > One observation, though. When I changed the specifier to public in the super > class as in the example below, I get the compiler error as mentioned in the > comment #0. However, this error doesn't appear if the compiler level is set to > >= 1.4. [...] > Looking at the code, this might be the expected behavior after all. Yes, Please see http://dev.eclipse.org/mhonarc/lists/jdt-core-dev/msg00071.html (The JLS sections mentioned there is not w.r.t JLS3). So this is a deliberate choice. See also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=3350 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=3361 Created attachment 174113 [details]
Same patch after CVS synchronization.
Released in HEAD for 3.7 M1. Verified for 3.7M1. |