JDK-6234651 : PackageDeclaration.getFoo methods fail to screen out inner classes
  • Type: Bug
  • Component: tools
  • Sub-Component: apt
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2005-03-01
  • Updated: 2010-08-06
  • Resolved: 2009-09-22
Related Reports
Relates :  
Relates :  
Description
The specifications for the PackageDeclaration.getFoo methods state they only return top-level classes.  The implementation actually returns innter classes too; they should be screened out.
###@###.### 2005-03-01 23:24:50 GMT

Comments
EVALUATION The apt tool and its API have been deprecated as of JDK 7 (6381698). By default, issues with annotation processing will only be fixed in the standardized JSR 269 processing in javac as of JDK 6. Since this issue does not exist with the JSR 269 processing in javac, this bug is being closed as will not fix.
22-09-2009

EVALUATION com.sun.tools.javac.code.Symbol.TypeSymbol.getEnclosedElements() has the right behavior. The trick is to make sure that the class file has been read (completed). This is implicitly done in TypeSymbol.getEnclosedElements by calling flags(). Then all that remains is to verify that the element is actually a member of the package: e.sym.owner == this.
13-04-2006

EVALUATION After more investigation, the difference in behavior seems to stem from a difference in how javac creates members of a package when the package symbol is created from source files or from class files. When created from class files, non-top-level classes also seem to be listed as package members.
03-04-2006

EVALUATION Challenging to reproduce; should be investigated. ###@###.### 2005-04-18 23:57:01 GMT
18-04-2005