Summary: | JDT compiler does allow access to private members where javac doesn't | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Sven Köhler <sven.koehler> |
Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> |
Status: | VERIFIED DUPLICATE | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | amj87.iitr, jarthana, srikanth_sankaran |
Version: | 3.7.1 | ||
Target Milestone: | 3.7 M6 | ||
Hardware: | PC | ||
OS: | Linux | ||
Whiteboard: |
Description
Sven Köhler
2011-11-05 10:56:05 EDT
Note that javac 1.7 reports errors on both class Foo and Javabug (from the bug reports above) no matter whether the source level is 1.6 or 1.5 while at the same time, javac 1.6 and 1.5 report no errors. Not sure, what JDT's compiler should do. This has already been fixed in 3.7. Please use a newer build. *** This bug has been marked as a duplicate of bug 334622 *** Sven, even with 3.7.1 this works as expected. Can you please re-check? Note that the private members are not allowed to be accessed from *type parameters* only. You are right. The JDT compiler reports an error for the classes Foo and JavaBug, but only if the compiler compliance level is set to 1.7. Is this the correct behaviour, concerning that javac 1.7 reports errors no matter whether source/target level are set to 1.5, 1.6, or 1.7? IMHO, JDT should follow javac 1.7's behaviour, and always report the error. (In reply to comment #4) > You are right. The JDT compiler reports an error for the classes Foo and > JavaBug, but only if the compiler compliance level is set to 1.7. > > Is this the correct behaviour, concerning that javac 1.7 reports errors no > matter whether source/target level are set to 1.5, 1.6, or 1.7? JDT shows this behaviour as well. There are 2 settings in JDT: 1) Compliance: This is a special setting to ask the user which javac he wants JDT to mimic. 2) Source: This is similar to javac's source flag, and asks the user which java's language features he wants to use. In this case, since ONLY javac7 gives an error, the compliance should be set to 1.7. You can then try changing source levels as you want, and JDT will always give an error. Ofcourse, if you change the compliance itself to 1.6, JDT will start to mimic javac6 and no longer give any error. HTH *** This bug has been marked as a duplicate of bug 334622 *** Verified for 3.8M4 with build I20111204-2000. |