Bug 134586 - Compiler exception with nested generics eg: <T extends Enum<T>>
Summary: Compiler exception with nested generics eg: <T extends Enum<T>>
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-03 15:18 EDT by Andrew Eisenberg CLA
Modified: 2006-05-18 04:28 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Eisenberg CLA 2006-04-03 15:18:39 EDT
I am using AspectJ version: 1.5.1.20060131132251.  I don't know which number this relates to above.


I think there is an error in handling generics inside generics.  This statement seems to be giving me trouble:

<T extends Enum<T>> 

I create this ITD:

  public <T extends Enum<T>> T Annotation.getEnum(String key, Class<T> enumClass) {
    return null;
  }

and I get the exception copied below.

But, I create this ITD, and there is no exception (no nested generics):

  public <T extends Enum> T Annotation.getEnum(String key, Class<T> enumClass) {
    return null;
  }


This is the error spit out by the first ITD:


org.aspectj.apache.bcel.classfile.ClassFormatException
at org.aspectj.apache.bcel.classfile.Utility.typeOfSignature(Utility.java:1293)
at org.aspectj.apache.bcel.generic.Type.getTypeInternal(Type.java:166)
at org.aspectj.apache.bcel.generic.Type.getType(Type.java:155)
at org.aspectj.weaver.bcel.BcelWorld.makeBcelType(BcelWorld.java:208)
at org.aspectj.weaver.bcel.BcelTypeMunger.makeMethodGen(BcelTypeMunger.java:611)
at org.aspectj.weaver.bcel.BcelTypeMunger.mungeNewMethod(BcelTypeMunger.java:777)
at org.aspectj.weaver.bcel.BcelTypeMunger.munge(BcelTypeMunger.java:87)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:423)
at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:105)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1543)
at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1494)
at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1275)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1097)
at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:300)
at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:178)
at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:70)
at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:367)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:824)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:234)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:189)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:164)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

trouble in: 
public abstract class org.eclipse.jdt.core.dom.Annotation extends org.eclipse.jdt.core.dom.Expression implements org.eclipse.jdt.core.dom.IExtendedModifier:
  org.eclipse.jdt.core.dom.Name typeName
  static Class class$0 [Synthetic]
  public String ajc$interField$ca_ubc_cs_wrapper_AnnotationWrapper$qualifiedTypeName [RuntimeVisibleAnnotations]
  abstract org.eclipse.jdt.core.dom.ChildPropertyDescriptor internalTypeNameProperty();

  public final org.eclipse.jdt.core.dom.ChildPropertyDescriptor getTypeNameProperty():
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 42)
                    INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.internalTypeNameProperty ()Lorg/eclipse/jdt/core/dom/ChildPropertyDescriptor;
                    ARETURN
  end public final org.eclipse.jdt.core.dom.ChildPropertyDescriptor getTypeNameProperty()

  static final org.eclipse.jdt.core.dom.ChildPropertyDescriptor internalTypeNamePropertyFactory(Class):
                    NEW org.eclipse.jdt.core.dom.ChildPropertyDescriptor   (line 52)
                    DUP
                    ALOAD_0     // java.lang.Class nodeClass
                    LDC "typeName"
                    GETSTATIC org.eclipse.jdt.core.dom.Annotation.class$0 Ljava/lang/Class;
                    DUP
                    IFNONNULL L0
                    POP
    catch java.lang.ClassNotFoundException -> E0
    |               LDC "org.eclipse.jdt.core.dom.Name"
    |               INVOKESTATIC java.lang.Class.forName (Ljava/lang/String;)Ljava/lang/Class;
    catch java.lang.ClassNotFoundException -> E0
                    DUP
                    PUTSTATIC org.eclipse.jdt.core.dom.Annotation.class$0 Ljava/lang/Class;
                    GOTO L0
                E0: NEW java.lang.NoClassDefFoundError
                    DUP_X1
                    SWAP
                    INVOKEVIRTUAL java.lang.Throwable.getMessage ()Ljava/lang/String;
                    INVOKESPECIAL java.lang.NoClassDefFoundError.<init> (Ljava/lang/String;)V
                    ATHROW
                L0: ICONST_1
                    ICONST_0
                    INVOKESPECIAL org.eclipse.jdt.core.dom.ChildPropertyDescriptor.<init> (Ljava/lang/Class;Ljava/lang/String;Ljava/lang/Class;ZZ)V
                    ARETURN
  end static final org.eclipse.jdt.core.dom.ChildPropertyDescriptor internalTypeNamePropertyFactory(Class)

  void <init>(org.eclipse.jdt.core.dom.AST):
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 71)
                    ALOAD_1     // org.eclipse.jdt.core.dom.AST ast
                    INVOKESPECIAL org.eclipse.jdt.core.dom.Expression.<init> (Lorg/eclipse/jdt/core/dom/AST;)V
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 59)
                    ACONST_NULL
                    PUTFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
                    RETURN   (line 72)
  end void <init>(org.eclipse.jdt.core.dom.AST)

  public boolean isModifier():
                    ICONST_0   (line 78)
                    IRETURN
  end public boolean isModifier()

  public boolean isAnnotation():
                    ICONST_1   (line 85)
                    IRETURN
  end public boolean isAnnotation()

  public org.eclipse.jdt.core.dom.Name getTypeName():
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 94)
                    GETFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
                    IFNONNULL L1
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 96)
                    DUP
                    ASTORE_1
                    MONITORENTER
    finally -> E1
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 97)
    |               GETFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
    |               IFNONNULL L0
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 98)
    |               INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.preLazyInit ()V
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 99)
    |               NEW org.eclipse.jdt.core.dom.SimpleName
    |               DUP
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this
    |               GETFIELD org.eclipse.jdt.core.dom.Annotation.ast Lorg/eclipse/jdt/core/dom/AST;
    |               INVOKESPECIAL org.eclipse.jdt.core.dom.SimpleName.<init> (Lorg/eclipse/jdt/core/dom/AST;)V
    |               PUTFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 100)
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this
    |               GETFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
    |               ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this
    |               INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.internalTypeNameProperty ()Lorg/eclipse/jdt/core/dom/ChildPropertyDescriptor;
    |               INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.postLazyInit (Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/ChildPropertyDescriptor;)V
    |           L0: ALOAD_1   (line 96)
    |               MONITOREXIT
    finally -> E1
                    GOTO L1
    finally -> E1
    |           E1: ALOAD_1
    |               MONITOREXIT
    finally -> E1
                    ATHROW
                L1: ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 104)
                    GETFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
                    ARETURN
  end public org.eclipse.jdt.core.dom.Name getTypeName()

  public void setTypeName(org.eclipse.jdt.core.dom.Name):
                    ALOAD_1     // org.eclipse.jdt.core.dom.Name typeName   (line 118)
                    IFNONNULL L0
                    NEW java.lang.IllegalArgumentException   (line 119)
                    DUP
                    INVOKESPECIAL java.lang.IllegalArgumentException.<init> ()V
                    ATHROW
                L0: ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 121)
                    INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.internalTypeNameProperty ()Lorg/eclipse/jdt/core/dom/ChildPropertyDescriptor;
                    ASTORE_2
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 122)
                    GETFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
                    ASTORE_3
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 123)
                    ALOAD_3     // org.eclipse.jdt.core.dom.ASTNode oldChild
                    ALOAD_1     // org.eclipse.jdt.core.dom.Name typeName
                    ALOAD_2     // org.eclipse.jdt.core.dom.ChildPropertyDescriptor p
                    INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.preReplaceChild (Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/ChildPropertyDescriptor;)V
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 124)
                    ALOAD_1     // org.eclipse.jdt.core.dom.Name typeName
                    PUTFIELD org.eclipse.jdt.core.dom.Annotation.typeName Lorg/eclipse/jdt/core/dom/Name;
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 125)
                    ALOAD_3     // org.eclipse.jdt.core.dom.ASTNode oldChild
                    ALOAD_1     // org.eclipse.jdt.core.dom.Name typeName
                    ALOAD_2     // org.eclipse.jdt.core.dom.ChildPropertyDescriptor p
                    INVOKEVIRTUAL org.eclipse.jdt.core.dom.Annotation.postReplaceChild (Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/ASTNode;Lorg/eclipse/jdt/core/dom/ChildPropertyDescriptor;)V
                    RETURN   (line 126)
  end public void setTypeName(org.eclipse.jdt.core.dom.Name)

  public boolean isNormalAnnotation():
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 136)
                    INSTANCEOF org.eclipse.jdt.core.dom.NormalAnnotation
                    IRETURN
  end public boolean isNormalAnnotation()

  public boolean isMarkerAnnotation():
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 147)
                    INSTANCEOF org.eclipse.jdt.core.dom.MarkerAnnotation
                    IRETURN
  end public boolean isMarkerAnnotation()

  public boolean isSingleMemberAnnotation():
                    ALOAD_0     // org.eclipse.jdt.core.dom.Annotation this   (line 158)
                    INSTANCEOF org.eclipse.jdt.core.dom.SingleMemberAnnotation
                    IRETURN
  end public boolean isSingleMemberAnnotation()

  int memSize():
                    BIPUSH 44   (line 165)
                    IRETURN
  end int memSize()
end public abstract class org.eclipse.jdt.core.dom.Annotation

when type munging with (BcelTypeMunger ResolvedTypeMunger(Method, java.lang.Enum<T> org.eclipse.jdt.core.dom.Annotation.getEnum(java.lang.String, java.lang.Class<T>)))
when weaving type org.eclipse.jdt.core.dom.Annotation
when weaving classes 
when weaving 
when batch building BuildConfig[F:\Documents and Settings\Andrew Eisenberg\My Documents\workspace\.metadata\.plugins\org.eclipse.ajdt.core\Wrapper 3.2M4.generated.lst] #Files=7


thanks,
--andrew
Comment 1 Andrew Clement CLA 2006-05-18 04:28:23 EDT
Just checked and after recreating it at AspectJ1.5.0 level I can confirm it was fixed in AspectJ1.5.1a which came out on 10th April.