JDK-4992019 : Invalid generic signature attributes in two javax.crypto classes
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2004-02-10
  • Updated: 2004-04-14
  • Resolved: 2004-04-14
Related Reports
Relates :  
Relates :  
Relates :  
Description

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.

======================================================================

Comments
EVALUATION Neither of the two mentioned classes use generics, they are compiled with -source 1.4. Because of export control issues, they are then run through the DashO Pro obfuscator. Either the classfiles generated by the tool are invalid, or there is a bug in the JDK reflection or classfile parsing code. Reassigning for further evaluation. The javax.crypto.SunJCE_c class is an anonymous inner class, source code reads: === url = (URL)AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ProtectionDomain pd = clazz.getProtectionDomain(); if (pd != null) { CodeSource cs = pd.getCodeSource(); if (cs != null) { return cs.getLocation(); } } return NULL_URL; } }); === ###@###.### 2004-02-11 In order to get all the relevant reflection APIs implemented properly, we will be adding text to the JLS that requires that local and anonymous classes be named in a particular way. Anonymous classes will have to be given a binary name that is the binary name of the enclosing class followed by a "$" followed by some ascii digits. Once that spec is spelled out, code such as these renamed classes will not be able to be used reliably with the reflection APIs unless the renaming is modified appropriately. We will also be adding APIs to determine if a class is local or anonymous based on these required naming conventions. ###@###.### 2004-02-11 Probably a dup of 4987888. Conceivably the obfuscators will have to be updated to comply with version 49 class files. ###@###.### 2004-02-11 Not reproducible since build 42. ###@###.### 2004-04-13
11-02-2004