Bug 153845 - [generics] Problem with signature for generic type
Summary: [generics] Problem with signature for generic type
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.3   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-14 21:28 EDT by Matt Whitlock CLA
Modified: 2006-09-21 11:02 EDT (History)
1 user (show)

See Also:


Attachments
Testcase: Ant driven (4.95 KB, application/zip)
2006-09-11 13:37 EDT, John D. Heintz CLA
no flags Details
Team Project Set file for failing case (388 bytes, application/octet-stream)
2006-09-20 19:14 EDT, John D. Heintz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock CLA 2006-08-14 21:28:08 EDT
public aspect OuterAspect {

  private pointcut isSetter() : execution(void set*(..));

  public static aspect InnerAspect pertarget(isSetter()) {

  }

}


java.lang.IllegalStateException
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.parseFieldTypeSignature(GenericSignatureParser.java:163)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.parseTypeArgument(GenericSignatureParser.java:253)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.maybeParseTypeArguments(GenericSignatureParser.java:261)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.parseClassTypeSignature(GenericSignatureParser.java:208)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.parseAsClassSignature(GenericSignatureParser.java:56)
at org.aspectj.apache.bcel.classfile.Signature.asClassSignature(Signature.java:315)
at org.aspectj.apache.bcel.classfile.JavaClass.getGenericClassTypeSignature(JavaClass.java:973)
at org.aspectj.weaver.bcel.BcelObjectType.initializeFromJavaclass(BcelObjectType.java:164)
at org.aspectj.weaver.bcel.BcelObjectType.<init>(BcelObjectType.java:131)
at org.aspectj.weaver.bcel.BcelWorld.buildBcelDelegate(BcelWorld.java:337)
at org.aspectj.weaver.bcel.BcelWorld.addSourceObjectType(BcelWorld.java:395)
at org.aspectj.weaver.bcel.BcelWeaver.addIfAspect(BcelWeaver.java:263)
at org.aspectj.weaver.bcel.BcelWeaver.addAspectsFromDirectory(BcelWeaver.java:255)
at org.aspectj.weaver.bcel.BcelWeaver.addLibraryJarFile(BcelWeaver.java:205)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBcelWorld(AjBuildManager.java:698)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:223)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:199)
at org.aspectj.ajdt.internal.core.builder.AjBuildManager.incrementalBuild(AjBuildManager.java:170)
at org.aspectj.ajde.internal.CompilerAdapter.compile(CompilerAdapter.java:117)
at org.aspectj.ajde.internal.AspectJBuildManager$CompilerThread.run(AspectJBuildManager.java:191)

IllegalStateException thrown: Expecting [,L, or T, but found Pjava while unpacking Ljava/util/AbstractSet<Pjava/util/Map$Entry<TK;TV;>;>;
Comment 1 Andrew Clement CLA 2006-08-15 03:08:43 EDT
Are you on 1.5.2 or a dev build of 1.5.3?

I tried just compiling the aspect you included, worked fine.  Given that the signature it has trouble with is 

"Ljava/util/AbstractSet<Pjava/util/Map$Entry<TK;TV;>;>;"

something else must be involved - since your aspect doesn't use collection classes.  How are you compiling that aspect? Are you weaving rt.jar?
Comment 2 Matt Whitlock CLA 2006-08-15 03:17:20 EDT
I can't reproduce it anymore.  I'm using AspectJ 1.5.2 with AJDT 1.4 on Eclipse 3.2.  I was not trying to weave into rt.jar.  I'll reopen this bug if I come across it again and can make a reproducible test case for you.
Comment 3 John D. Heintz CLA 2006-09-11 13:37:26 EDT
Created attachment 49854 [details]
Testcase: Ant driven

This small project demonstrate the BCEL exception for this bug. The project assumes a lib directory with the AspectJ jars (I used aspectj-DEVELOPMENT-20060907092616.jar for this).
Comment 4 John D. Heintz CLA 2006-09-11 13:40:10 EDT
I've added a test case that demonstrates this bug.
Comment 5 Andrew Clement CLA 2006-09-13 12:41:33 EDT
thanks for the testcase - I've been able to work out how the rogue signature is getting into the class output during the first compilation.
Comment 6 Andrew Clement CLA 2006-09-14 06:40:33 EDT
I stripped down the testcase to the bare minimum.

Basically you need to have some type that implements/extends a generic type, eg.

Foo extends List<Set<String>>

(and the generic reference has to be nested, can't be List<String> - needs to be more complex).

That type must be affected by a declare parents to cause the signature to change, this will result in a broken signature on disk (so assume declare parents: Foo implements Serializable):

Ljava/util/List<Pjava/util/Set<Ljava/lang/String;>;>;

(see the rogue P)

then that has to be used in a subsequent weave and the weaver will blow up when unpacking it.  The fix is trivial ;)

Test and fix checked in - the fix is likely to address any/all related bugs that  suffer this same illegal state exception.
Comment 7 Andrew Clement CLA 2006-09-14 09:26:12 EDT
fix available in AJ dev builds.
Comment 8 John D. Heintz CLA 2006-09-20 19:12:19 EDT
Still getting this problem, but only from AJDT - it seems to work perfectly well in Ant/AspectJ.

I'll attach a Team Project Set file with two projects that generate this failure. Sorry for the moderate download size. (Depends on Subclipse for Subversion access).

The stack trace is a little different from Eclipse as well, here is a copy:
java.lang.IllegalStateException
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.parseFieldTypeSignature(GenericSignatureParser.java:163)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.parseTypeArgument(GenericSignatureParser.java:253)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.maybeParseTypeArguments(GenericSignatureParser.java:261)
at org.aspectj.apache.bcel.classfile.GenericSignatureParser.pars ... teException thrown: Expecting [,L, or T, but found Pjava while unpacking Ljava/lang/ThreadLocal<Pjava/util/Set<Ldash/obtain/provider/ObtainLookup;>;>;
Comment 9 John D. Heintz CLA 2006-09-20 19:14:44 EDT
Created attachment 50611 [details]
Team Project Set file for failing case

This Team Project Set file points to two Eclipse projects that demonstrate the failure in AJDT.
Comment 10 Andrew Clement CLA 2006-09-21 03:15:15 EDT
i dont believe AJDT has been upgraded with the most recent AspectJ build... hence it is still failing...
Comment 11 Helen Beeken CLA 2006-09-21 11:02:02 EDT
The latest 1.4 and 1.5 AJDT dev builds now contain this fix.