JDK-4983278 : GenericSignatureFormatError when attempting getGenericInterfaces(Class.java:752)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-01-24
  • Updated: 2012-09-28
  • Resolved: 2004-01-24
Related Reports
Duplicate :  
Description

Name: tb29552			Date: 01/24/2004


FULL PRODUCT VERSION :
JDK 1.5 alpha

ADDITIONAL OS VERSION INFORMATION :
Windows XP

A DESCRIPTION OF THE PROBLEM :
import java.lang.reflect.*;
public class BugTest {
   public static void main(String[] args) {
      Class c = TypeVariable.class;
      Type[] types = c.getGenericInterfaces();
   }
}
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:1708)
        at java.lang.Class.getGenericInterfaces(Class.java:748)
        at BugTest.main(BugTest.java:6)
Exception in thread "main"


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See code

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The problem comes when a type parameter extends an interface
<E extends Comparable> fail
<E Extends Object &Comparable> work


ERROR MESSAGES/STACK TRACES THAT OCCUR :
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:1708)
        at java.lang.Class.getGenericInterfaces(Class.java:748)
        at BugTest.main(BugTest.java:6)
Exception in thread "main"


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.lang.reflect.*;
public class BugTest {
   public static void main(String[] args) {
      Class c = TypeVariable.class;
      Type[] types = c.getGenericInterfaces();
   }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No workaround for jdk classes
(Incident Review ID: 235574) 
======================================================================

Comments
EVALUATION Dup of 4979440; will be fixed in beta 2. ###@###.### 2004-01-24
24-01-2004