Name: siR10004 Date: 02/10/2004
The following two JDK classes
javax.crypto.SunJCE_c
javax.crypto.SunJCE_e
cause 'Constructor.getTypeParameters()' failure with 'GenericSignatureFormatError'
exception thrown.
To reproduce, run the following script
------------------------------------------------------
#!/bin/sh
set -x
JH=/home/isl/space/Refs/jdks/jdk1.5.0-b37/solaris-sparc
cat > Probe.java << EOF
import java.lang.reflect.*;
public class Probe
{
public static void main (String[] args) throws Throwable
{
Class c = Class.forName(args[0], false, null);
Constructor[] ctors = c.getDeclaredConstructors();
if (ctors != null)
for (int i = 0; i < ctors.length; i++)
ctors[i].getTypeParameters();
}
}
EOF
$JH/bin/javac Probe.java
$JH/bin/java -cp . Probe javax.crypto.SunJCE_c
$JH/bin/java -cp . Probe javax.crypto.SunJCE_e
------------------------------------------------------
Here is the script output:
------------------------------------------------------
+ /home/isl/space/Refs/jdks/jdk1.5.0-b37/solaris-sparc/bin/java -cp . Probe javax.crypto.SunJCE_c
Exception in thread "main" java.lang.reflect.GenericSignatureFormatError
at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
at sun.reflect.generics.parser.SignatureParser.parseFormalParameters(SignatureParser.java:428)
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.ConstructorRepository.make(ConstructorRepository.java:51)
at java.lang.reflect.Constructor.getGenericInfo(Constructor.java:70)
at java.lang.reflect.Constructor.getTypeParameters(Constructor.java:180)
at Probe.main(Probe.java:10)
+ /home/isl/space/Refs/jdks/jdk1.5.0-b37/solaris-sparc/bin/java -cp . Probe javax.crypto.SunJCE_e
Exception in thread "main" java.lang.reflect.GenericSignatureFormatError
at sun.reflect.generics.parser.SignatureParser.error(SignatureParser.java:103)
at sun.reflect.generics.parser.SignatureParser.parseFormalParameters(SignatureParser.java:428)
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.ConstructorRepository.make(ConstructorRepository.java:51)
at java.lang.reflect.Constructor.getGenericInfo(Constructor.java:70)
at java.lang.reflect.Constructor.getTypeParameters(Constructor.java:180)
at Probe.main(Probe.java:10)
------------------------------------------------------
Perhaps the cause of these failures is bad 'Signature' attributes.
Constructor of class 'javax.crypto.SunJCE_c' has this attribute
with value 'f' and constructor of class 'javax.crypto.SunJCE_e'
has 'Signature' attribute with value 'java/lang/Exception'.
Both classes have 45:3 classfile version.
======================================================================
- relates to
-
JDK-4994508 javac should not output new attributes (only Bridge) with -target 1.4
- Resolved
-
JDK-5003916 (reflect) 24 classes from java package cause GenericSignatureFormatError
- Closed
-
JDK-4987888 (reflect) Generic signature for inner classes crashes runtime
- Resolved