JDK-6194785 : ParameterDeclaration.getSimpleName does not return actual name from class files
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2004-11-12
  • Updated: 2010-05-08
  • Resolved: 2006-03-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b75Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
When run with -XclassesAsDecls, ParameterDeclaration.getSimpleName does not return the actual parameter names if the declarations are class files, even if the class files have been compiled with debugging information.  This causes difficulties for some apt clients.
###@###.### 2004-11-12 19:08:41 GMT

Comments
SUGGESTED FIX Webrev of changes: http://sa.sfbay/projects/langtools/bugid_summary.pl?bugid=6374357
24-02-2006

EVALUATION As apt already passes -XDsave-parameter-names to javac, apt works for free after fixing this issue in javac/JSR 269.
23-02-2006

SUGGESTED FIX * implement readCode (actually, just skip the byte codes): Code readCode(Symbol owner) { final char max_stack = nextChar(); final char max_locals = nextChar(); final int code_length = nextInt(); bp += code_length; final char exception_table_length = nextChar(); bp += exception_table_length * 8; readMemberAttrs(owner); return null; } * read Code attributes if -XDsave-parameter-names or ClassReader.readAllOfClassFile: - if (readAllOfClassFile) ((MethodSymbol)sym).code = readCode(sym); - else bp = bp + attrLen; + if (readAllOfClassFile || saveParameterNames) + ((MethodSymbol)sym).code = readCode(sym); + else + bp = bp + attrLen; * Set -XDsave-parameter-names when annotation processing is enabled.
23-02-2006

EVALUATION Several problems: * ClassReader expects option -XDsave-parameter-names * To read code attributes, ClassReader.readAllOfClassFile must be true * ClassReader.readCode was not implemented Consequently, there was no way to read parameter names.
23-02-2006

EVALUATION Probably a bug in the compiler's ClassReader.
15-02-2006

EVALUATION A fine idea. ###@###.### 2004-11-12 19:08:42 GMT Responding to a JDC comment, bug 5052664 tracks adding a method to return the parameter names via core reflection. ###@###.### 2005-1-25 00:22:32 GMT
12-11-2004