Community
Participate
Working Groups
The compiler shows an error for allowed inner class code. It apparently doesn't take into account this clarification of inner classes: "The nested classes white paper states that Any inherited member m of a subclass C is in scope within the body of C, including any inner classes within C. If C itself is an inner class, there may be definitions of the same kind (variable, method, or type) for m in enclosing scopes. (The scopes may be blocks, classes, or packages.) In all such cases, the inherited member m hides the other definitions of m. <b>Additionally, unless the hidden definition is a package member, the simple name m is illegal; the programmer must write C.this.m.</b> The restriction listed in the last sentence of the paragraph above (the bold text) has been lifted." from http://java.sun.com/docs/books/jls/nested-class-clarify.html So, Sun's JDK compilers allow this: public class blah { public static class Entry extends HashMap { public boolean equals(Object foo) { if (foo instanceof Entry)... } } } while Eclipse's compiler does not (and the Eclipse compiler stops dead with an error to make it worse. The error is "The type Entry is defined in an inherited type and an enclosing scope"). That clarification means that having just plain "Entry" resolves to blah.this.Entry instead of Map.Entry without having to put the blah.this qualifier on it.
Which build are you referring to ? This is a duplicate of bug 32342. In RC1 build, I can compile clear your code snippet. *** This bug has been marked as a duplicate of 32342 ***