JDK-6476261 : (reflect) GenericSignatureFormatError When signature includes nested inner classes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 5.0,6,7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2006-09-28
  • Updated: 2012-09-28
  • Resolved: 2012-05-07
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 7 JDK 8
7u2Fixed 8 b04Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
J2SE Version (please include all output from java -version flag):

  java version "1.6.0-rc"
  Java(TM) SE Runtime Environment (build 1.6.0-rc-b99)
  Java HotSpot(TM) Client VM (build 1.6.0-rc-b99, mixed mode)

Does this problem occur on J2SE 1.4.x or 5.0.x ?  Yes / No (pick one)
  Yes in build 1.5.0_08-b03.

Operating System Configuration Information (be specific):
  Windows XP sp-2


Hardware Configuration Information (be specific):
  Intel Pentium IV 3GHz

Bug Description:
  GenericSignatureFormatError when signature includes nested inner classes.


Steps to Reproduce (be specific):
1) Compile the following source code.

/// Start Source ///
import java.lang.reflect.*;

public class SignatureTest0<T> {
   class Inner1 {
      class Inner11 {
      }
   }

   public void f(SignatureTest0<String>.Inner1.Inner11 x) {}

   public void g(SignatureTest0<String>.Inner1 x) {}

   public static void main(String[] args) throws Exception {
      Class clazz = SignatureTest0.class;
      Method[] methods0 = clazz.getDeclaredMethods();
      for(int i=0; i < methods0.length; i++) {
         Method m0 = methods0[i];
         System.out.println("#" + i + ". " + m0);
         m0.getGenericParameterTypes();
      }
   }
}
/// End Source ///

2) Run the test case using the command "java SignatureTest0"

3) You get the following output.

#0. public static void SignatureTest0.main(java.lang.String[]) throws java.lang.
Exception
#1. public void SignatureTest0.f(SignatureTest0$Inner1$Inner11)
Exception in thread "main" java.lang.reflect.GenericSignatureFormatError
        at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
        at sun.reflect.generics.parser.SignatureParser.parseSimpleClassTypeSignature(SignatureParser.java:262)
        at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignatureSuffix(SignatureParser.java:270)
        at sun.reflect.generics.parser.SignatureParser.parseClassTypeSignature(SignatureParser.java:244)
        at sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:228)
        at sun.reflect.generics.parser.SignatureParser.parseTypeSignature(SignatureParser.java:359)
        at sun.reflect.generics.parser.SignatureParser.parseZeroOrMoreTypeSignatures(SignatureParser.java:469)
        at sun.reflect.generics.parser.SignatureParser.parseFormalParameters(SignatureParser.java:446)
        at sun.reflect.generics.parser.SignatureParser.parseMethodTypeSignature(SignatureParser.java:436)
        at sun.reflect.generics.parser.SignatureParser.parseMethodSig(SignatureParser.java:141)
        at sun.reflect.generics.repository.ConstructorRepository.parse(ConstructorRepository.java:37)
        at sun.reflect.generics.repository.ConstructorRepository.parse(ConstructorRepository.java:25)
        at sun.reflect.generics.repository.AbstractRepository.<init>(AbstractRepository.java:56)
        at sun.reflect.generics.repository.GenericDeclRepository.<init>(GenericDeclRepository.java:30)
        at sun.reflect.generics.repository.ConstructorRepository.<init>(ConstructorRepository.java:33)
        at sun.reflect.generics.repository.MethodRepository.<init>(MethodRepository.java:28)
        at sun.reflect.generics.repository.MethodRepository.make(MethodRepository.java:41)
        at java.lang.reflect.Method.getGenericInfo(Method.java:94)
        at java.lang.reflect.Method.getGenericParameterTypes(Method.java:282)
        at SignatureTest0.main(SignatureTest0.java:19)

Comments
SUGGESTED FIX See attachment.
23-08-2011

PUBLIC COMMENTS See http://hg.openjdk.java.net/jdk8/tl/jdk/rev/b1f99f9c2879
23-08-2011

EVALUATION Problem reproduced, investigating.
29-09-2006