United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6476261 (reflect) GenericSignatureFormatError When signature includes nested inner classes
JDK-6476261 : (reflect) GenericSignatureFormatError When signature includes nested inner classes

Details
Type:
Bug
Submit Date:
2006-09-28
Status:
Closed
Updated Date:
2012-09-28
Project Name:
JDK
Resolved Date:
2012-05-07
Component:
core-libs
OS:
generic,windows_xp
Sub-Component:
java.lang:reflect
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0,6,7
Fixed Versions:

Related Reports
Backport:
Duplicate:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

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
EVALUATION

Problem reproduced, investigating.
                                     
2006-09-29
SUGGESTED FIX

See attachment.
                                     
2011-08-23
PUBLIC COMMENTS

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



Hardware and Software, Engineered to Work Together