Name: siR10004 Date: 01/16/2004
Generic signature parser fails to parse return type of
the method 'getAnnotation ' from
the class 'java.lang.reflect.AccessibleObject'.
To reproduce, run the following simple script:
-----------------------------------------------------------
#!/bin/sh
set -x
JH=/home/isl/space/Refs/jdks/jdk1.5.0-b33/solaris-sparc
cat > Test.java << EOF
import java.lang.reflect.*;
public class Test {
public static void main (String[] args) throws Throwable {
Class c = Class.forName("java.lang.reflect.AccessibleObject");
Method[] ms = c.getDeclaredMethods();
for (int i = 0; i < ms.length; i++) {
System.out.println("method " + ms[i].getName());
ms[i].getGenericReturnType();
}
}
}
EOF
$JH/bin/javac -source 1.5 -target 1.5 Test.java
$JH/bin/java -cp . Test
-----------------------------------------------------------
Method.getGenericReturnType() fails with stack dump
method getAnnotation
Exception in thread "main" java.lang.reflect.GenericSignatureFormatError
at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
at
sun.reflect.generics.parser.SignatureParser.parseFieldTypeSignature(SignatureParser.java:233)
at
sun.reflect.generics.parser.SignatureParser.parseZeroOrMoreBounds(SignatureParser.java:399)
at
sun.reflect.generics.parser.SignatureParser.parseFormalTypeParameter(SignatureParser.java:199)
at
sun.reflect.generics.parser.SignatureParser.parseFormalTypeParameters(SignatureParser.java:188)
at
sun.reflect.generics.parser.SignatureParser.parseZeroOrMoreFormalTypeParameters(SignatureParser.ja
va:177)
at
sun.reflect.generics.parser.SignatureParser.parseMethodTypeSignature(SignatureParser.java:420)
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:88)
at java.lang.reflect.Method.getGenericReturnType(Method.java:230)
at Test.main(Test.java:8)
This bug is reproduced on b33.
This bug cases failure of jck SignatureTest.
======================================================================
- duplicates
-
JDK-4979424 (reflect) Class.getTypeParameters() fails when first bound is interface
- Closed
-
JDK-4983278 GenericSignatureFormatError when attempting getGenericInterfaces(Class.java:752)
- Closed
- relates to
-
JDK-4987888 (reflect) Generic signature for inner classes crashes runtime
- Resolved