Bug 334710 - pre compiled aspects with 1.6.7 causing java.lang.NegativeArraySizeException
Summary: pre compiled aspects with 1.6.7 causing java.lang.NegativeArraySizeException
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 critical (vote)
Target Milestone: 1.6.11   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-18 16:16 EST by Ahmed Al Kahky CLA
Modified: 2011-02-21 00:20 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmed Al Kahky CLA 2011-01-18 16:16:08 EST
Build Identifier: SpringSource Tool Suite Version: 2.5.2.RELEASE Build Id: 201101081000

I have a dependencies on my project on other libraries using aspectj and compiled with aspectj 1.6.7 when compiling my project with aspectj 1.6.11 the following error appears
java.lang.NegativeArraySizeException
at org.aspectj.weaver.patterns.TypePatternList.read(TypePatternList.java:490)
at org.aspectj.weaver.patterns.ThrowsPattern.read(ThrowsPattern.java:120)
at org.aspectj.weaver.patterns.SignaturePattern.read(SignaturePattern.java:913)
at org.aspectj.weaver.patterns.KindedPointcut.read(KindedPointcut.java:335)
at org.aspectj.weaver.patterns.Pointcut.read(Pointcut.java:279)
at org.aspectj.weaver.patterns ... ildJob.run(AJBuildJob.java:43)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Compile error: NegativeArraySizeException thrown: null

Reproducible: Always

Steps to Reproduce:
1. have some aspects compiled with 1.6.7
2. add jar file containing the compiled aspects to the class path of a new project using aspectj 1.6.11
3. build the new project 
4. the error message will appear
Comment 1 Ahmed Al Kahky CLA 2011-01-18 16:36:39 EST
another exception appears after that as following:

org.aspectj.weaver.BCException
at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:139)
at org.aspectj.weaver.bcel.Utility.readAjAttributes(Utility.java:101)
at org.aspectj.weaver.bcel.BcelMethod.unpackAjAttributes(BcelMethod.java:185)
at org.aspectj.weaver.bcel.BcelMethod.<init>(BcelMethod.java:91)
at org.aspectj.weaver.bcel.BcelObjectType.getDeclaredMethods(BcelObjectType.java:289)
at org.aspectj.weaver.ReferenceType.getDeclaredM ... ram Files\Java\jdk1.6.0_20\jre\lib\ext\sunpkcs11.jar;D:\springsource2.5.2\sts-2.5.2.RELEASE\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar;
Comment 2 Andrew Clement CLA 2011-01-19 11:31:01 EST
Hmmm, AspectJ 1.6.7 shouldn't really be used.  1.6.8 came out a couple of days after it due to it having a few serious issues.  Are you able to recompile the libraries with 1.6.8 and tell me if it makes any difference?
Comment 3 Ahmed Al Kahky CLA 2011-01-20 16:17:46 EST
(In reply to comment #2)
> Hmmm, AspectJ 1.6.7 shouldn't really be used.  1.6.8 came out a couple of days
> after it due to it having a few serious issues.  Are you able to recompile the
> libraries with 1.6.8 and tell me if it makes any difference?

Compiled the aspects with 1.6.10 and tried to run it with 1.6.11 but still getting the following exception 

org.aspectj.weaver.BCException
at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:139)
at org.aspectj.weaver.bcel.Utility.readAjAttributes(Utility.java:101)
at org.aspectj.weaver.bcel.BcelMethod.unpackAjAttributes(BcelMethod.java:185)
at org.aspectj.weaver.bcel.BcelMethod.<init>(BcelMethod.java:91)
at
org.aspectj.weaver.bcel.BcelObjectType.getDeclaredMethods(BcelObjectType.java:289)
at org.aspectj.weaver.ReferenceType.getDeclaredM ... ram
Files\Java\jdk1.6.0_20\jre\lib\ext\sunpkcs11.jar;D:\springsource2.5.2\sts-2.5.2.RELEASE\plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar;
Comment 4 Andrew Clement CLA 2011-01-20 16:49:15 EST
Are you possibly able to share the aspects with me (compiled form would be fine) - so that I can debug this.  It is pretty serious.  Also, I would be interested if you could run it with 1.6.10 after compiling it with 1.6.10.
Comment 5 Andrew Clement CLA 2011-01-20 16:50:19 EST
oh, just want to check there isn't any other bytecode transformation going on is there? Between when it is compiled and when it is being used?
Comment 6 Ahmed Al Kahky CLA 2011-01-20 17:30:07 EST
(In reply to comment #5)
> oh, just want to check there isn't any other bytecode transformation going on
> is there? Between when it is compiled and when it is being used?

unfortunately I will not be able to share the code, the sequence of operation is java compilation the aspectj weaving no more transformaiton, but I noticed something that may help the exception message has changed to
Compile error: BCException thrown: malformed org.aspectj.weaver.EffectiveSignature attribute (length:141)java.io.EOFException
Comment 7 Andrew Clement CLA 2011-01-20 18:47:56 EST
although the error has changed, both errors have the same root cause - the serialized form of some AspectJ data structure, which is stored in the classfile, is wrong.  Unfortunately there are a lot of these structures, and without a failing example, it'll be tricky to address.  A failing sample should probably just consist of an aspect similar to what you have - using the same pointcuts but empty advice.  If you are able to come up with a small failing aspect, I'd be able to fix this pretty quickly, otherwise I'll just have to keep digging.
Comment 8 Andrew Clement CLA 2011-02-03 12:00:52 EST
Under bug 335682 I may have solved this problem.  Please grab an AJDT dev build and try it out http://download.eclipse.org/tools/ajdt/36/dev/update
Comment 9 Andrew Clement CLA 2011-02-21 00:20:48 EST
believed fixed, please let me know if still a problem with the latest builds.