Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6476261

(reflect) GenericSignatureFormatError When signature includes nested inner classes

    Details

    • Subcomponent:
    • Resolved In Build:
      b04
    • CPU:
      generic, x86
    • OS:
      generic, windows_xp
    • Verification:
      Verified

      Backports

        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)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  darcy Joe Darcy
                  Reporter:
                  tyao Ting-Yun Ingrid Yao (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  1 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: