Bug 33505

Summary: Compiler fails on allowed inner class code
Product: [Eclipse Project] JDT Reporter: Stephen Drye <eclipse>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 RC2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Stephen Drye CLA 2003-02-27 16:42:18 EST
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.
Comment 1 Philipe Mulet CLA 2003-02-28 05:53:28 EST
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 ***