| Summary: | Warning The method xxx from the type X is never used locally is shown for code using xxx from another class. | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Daniel Friederich <danielfriederich> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | Stephan Herrmann <stephan.herrmann> |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, stephan.herrmann |
| Version: | 4.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | stalebug | ||
|
Description
Daniel Friederich
Geewiz, always another surprise with Java. Conceptually, that's what I'd call an API leak: getPubDef() makes an inaccessible type accessible (kind-of, see below). Interesting twist: User cannot name Def.Privdef.PubDef but it can use it. Wow! Hint: try extracting "d.getPubDef()" to a local variable => Boom! Put differently, java seems to allow accessing a method of an inaccessible type. => Our assumption that membership in a private type restricts the accessibility is wrong. OTOH, I'd definitely not accept the above as good design. So maybe the warning (and resulting error if you remove the method) is a good thing to alert folks of the bad design :p On a related note: I just surfed JLS to figure out what should change for Jigsaw, and indeed could not find any requirement that the receiver type of a field access or method invocation must be accessible. Looks like a spec bug, if you ask me. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |