Summary: | Redefining a protected method in another package should not prevent to access it | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Hervé Le Bars <herve.lebars> |
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 3.0.1 | ||
Target Milestone: | 3.1 M6 | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Whiteboard: |
Description
Hervé Le Bars
2005-02-16 06:33:57 EST
What are your compiler settings? (In reply to comment #1) > What are your compiler settings? I use all the default settings, that comes when you just install the product. I use the 1.4.2_06 jdk from Sun. Its a little hard to "dump" all these settings here (is there an easy way to do that ?). But be sure I use all default values ... Access to protected method across package boundaries is quite constrained. "A protected member or constructor of an object may be accessed from outside the package in which it is declared only by code that is responsible for the implementation of that object." Please refer for more details to JLS 6.6.2 and 6.6.7. Basically, the following would compile fine. You can perform access from other package only within code which is a subclass of target member declaring class and only if invoked to itself (this or implicit receiver). package hlb.err; public class Test extends hlb.err.other.Leaf { void foo() { this.protectedMethod1(); } } |