Bug 33505 - Compiler fails on allowed inner class code
Summary: Compiler fails on allowed inner class code
Status: RESOLVED DUPLICATE of bug 32342
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-27 16:42 EST by Stephen Drye CLA
Modified: 2003-02-28 05:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***