Name: siR10004 Date: 01/16/2004
When class is declared with type parameter
class Test <X extends I>
but I is an interface (not a class) type, generic signature parser
fails to parse this type parameter.
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
public class Test<X extends I> {
public static void main (String[] args) throws Throwable {
Class c = new Test().getClass();
c.getTypeParameters();
}
}
interface I {}
EOF
$JH/bin/javac -source 1.5 -target 1.5 Test.java
$JH/bin/java -cp . Test
-----------------------------------------------------------
Class.getTypeParameters() fails with stack dump
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.java:177)
at sun.reflect.generics.parser.SignatureParser.parseClassSignature(SignatureParser.java:171)
at sun.reflect.generics.parser.SignatureParser.parseClassSig(SignatureParser.java:126)
at sun.reflect.generics.repository.ClassRepository.parse(ClassRepository.java:34)
at sun.reflect.generics.repository.ClassRepository.parse(ClassRepository.java:23)
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.ClassRepository.<init>(ClassRepository.java:30)
at sun.reflect.generics.repository.ClassRepository.make(ClassRepository.java:47)
at java.lang.Class.getGenericInfo(Class.java:1741)
at java.lang.Class.getTypeParameters(Class.java:579)
at Test.main(Test.java:4)
This bug is reproduced on b33.
======================================================================