Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] badWeaverState exception on iajc w/out prior clean

Hi Diane -

Thanks for pursuing this and creating a stripped-down version.

> (BTW, Wes...if I remove the destination dir from my inpath, those
> classes won't get woven, right? I do want them to be...)

It is a bug in your ajc/iajc specification to include the the same directory
on the inpath and as the destination directory.  Why not just remove test.classes
from the inpath?

I can't say whether this is the cause of the problem you see, or might be 
harmless under some implementations of AspectJ, but it makes no sense to me.  
Why would you include the output directory on the inpath?  Exactly this happens:
when some .class files are in the output/inpath directory, they duplicate and
compete with existing sources.  I'm not sure what ajc is supposed to do when 
it finds com.company.SomeClass in both .java- and .class-file form -- 
particularly when the .class version includes new join points from the prior 
weave.  Reweaving is not for achieving incremental compilation, but for 
successively applying different aspects at different stages of defining
a class.

There may be a bug in the compiler, but it looks to me now like the bug is
that ajc should handle this form of user error more gracefully.  I'll update
the devguide to state ~Results are undefined if there are multiple sources for 
any type in inpath/injars and source files, or if the destination directory
is included in inpath.~

Wes


> ------------Original Message------------
> From: "Ron Bodkin" <rbodkin@xxxxxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Thu, Mar-2-2006 5:14 PM
> Subject: RE: [aspectj-users] badWeaverState exception on iajc w/out prior clean
>
> Hi Diane,
> 
> I believe you have isolated a bug: the compiler should never have a
> badWeaverState from repeated compilation. It might have some 
> inconsistency
> in the definitions. I can reproduce this.
> 
> I can workaround this bug in your example by not putting test.classes 
> on the
> inpath: you shouldn't be including the old compiler output as an input 
> along
> with the sources. This will definitely break when some things change.
> 
> In general, I would definitely recommend keeping unwoven classes 
> separate
> from woven classes: have javac output to ${unwoven.classes} and put 
> that in
> say, ${build.home}/unwoven. I'd do the same thing for test.classes, 
> having
> another directory for ${unwoven.test.classes}. However, in your test 
> this
> isn't causing it to break.
> 
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Nguyen, Diane
> Sent: Thursday, March 02, 2006 4:56 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] badWeaverState exception on iajc w/out 
> prior
> clean
> 
> Hello,
> 
> Thanks again for helping me out. I decided to go back to the drawing
> board and created a very stripped down project (one class that does 
> next
> to nothing, a JUnit test for it, and an aspect used in the test). 
> Please
> see the attached zip for the source and build.xml. In the
> compile-tests-with-aspects target, I call the iajc task with nothing 
> for
> the classpath other than JUnit, aspectjrt.jar, and my classes. The
> inpath is just my classes and test.
> 
> (BTW, Wes...if I remove the destination dir from my inpath, those
> classes won't get woven, right? I do want them to be...)
> 
> When I ant clean, then compile-tests-with-aspects multiple times even
> without making any changes to the source in between, the first two
> compiles run successfully, but every subsequent compile gives me the 
> bad
> WeaverState exception. I've also attached the trace of the output.
> 
> I really appreciate all the help and hope there's a simple solution to
> this problem :)
> 
> diane
> 
> 
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Wes Isberg
> Sent: Saturday, February 25, 2006 12:55 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] badWeaverState exception on iajc w/out
> prior clean
> 
> Hi Diane -
> 
> re: "bad WeaverState.Kind: -115", kind 115 means
> - extended
>   - reweavable
>     - compressed
>     - diff
> and should be understood by the 1.5.0 weaver.
> Ron might be suggesting that the first build is with a recent weaver
> (produces kind 115), and the second with an older one (unable to
> understand kind 115).
> 
> Based on the original ant task you submitted, I'd suggest removing the
> destination directory from the inpath and adding forkclasspath when
> forking.  Also, if you want to build incrementally, use the incremental
> flag.  There is no optimization when batch- building a second time
> (unlike the Javac task, which can prune up-to-date classes).
> You can also explicitly set the reweavable options to see if that makes
> a difference.
> (Finally, I assume you are not running Ant against the same target
> classes as AJDT/eclipse.)
> 
> Let us know how it works out!  Maybe it is a bug!
> Wes
> 
> On Fri, 24 Feb 2006 12:58:57 -0800
>  "Ron Bodkin" <rbodkin@xxxxxxxxxxxxxx> wrote:
> > Hi Diane,
> > 
> > Could you post the ant task(s) that compile the AspectJ code? I am 
> > wondering if there's something about that that's causing the problem. 
> 
> > How are you determining what classes to recompile? Is it possible 
> that
> 
> > more than one ant task is recompiling to the same class files, but 
> > with different AspectJ configurations?
> > 
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx 
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Nguyen, Diane
> > Sent: Friday, February 24, 2006 9:43 AM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: RE: [aspectj-users] badWeaverState exception on iajc w/out 
> > prior clean
> > 
> > If I run ant clean, then ant, then ant again, things are fine, it 
> > succeeds because there weren't any changes to compile the second 
> time.
> > If I run ant clean, then ant, then make a change to my aspect or 
> test,
> 
> > then ant again, I get the exception.
> > 
> > I found that one of my colleagues DID install older versions of 
> > AspectJ.
> > There was an aspectjrt-1.1.1.jar in the ant lib directory, which I've 
> 
> > deleted. There was also an older aspectjrt jar installed with Cactus. 
> 
> > I removed the cactus jars from the classpath and removed our Cactus 
> > tests from the compilation. However, I still get the exception.
> > 
> > Other than that, I can't find any jars or source that was compiled 
> > with aspects or using the iajc task in my classpath or inpath.
> > 
> > Again, thanks your help!
> > 
> > diane
> > 
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx 
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
> > Sent: Wednesday, February 22, 2006 9:18 AM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: RE: [aspectj-users] badWeaverState exception on iajc w/out 
> > prior clean
> > 
> > Diane,
> > 
> > What happens if you run ant clean, then ant, then ant again? Does the 
> 
> > problem occur? Are you able to narrow down which jar
> > file(s) cause the
> > problem and how they get created?
> > 
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx 
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Nguyen, Diane
> > Sent: Tuesday, February 21, 2006 1:17 PM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: RE: [aspectj-users] badWeaverState exception on iajc w/out 
> > prior clean
> > 
> > Thanks for the response!
> > 
> > Unfortunately, I don't think that's what is causing my bad 
> WeaverState
> 
> > exception. I'm using ajdt 1.3.0 (the latest from the eclipse AJDT 
> > site) and AspectJ 1.5.0 from Dec 20 2005. These are the only aspectJ 
> > downloads I've installed on my computer, and this is the only iajc 
> > compilation in my build.xml file.
> > 
> > Does it matter what was used to compile the jars in my inpath? Just a 
> 
> > stab in the dark...
> > 
> > thanks again!
> > diane
> > 
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx 
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron Bodkin
> > Sent: Friday, February 17, 2006 4:57 PM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: RE: [aspectj-users] badWeaverState exception on iajc w/out 
> > prior clean
> > 
> > Hi Diane,
> > 
> > One likely reason for the problem is that you somehow have an older 
> > version of AspectJ that is doing some of the building.
> > E.g., are you
> > perhaps using a version of AJDT from before 1.5.0 final to build 
> these
> 
> > same classes? AspectJ 1.5.0 would choke on the output of development 
> > releases of AJDT from before AspectJ 1.5.0 final (AJDT 1.3.0 final).
> > 
> > -----Original Message-----
> > From: aspectj-users-bounces@xxxxxxxxxxx 
> > [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Nguyen, Diane
> > Sent: Friday, February 17, 2006 4:40 PM
> > To: aspectj-users@xxxxxxxxxxx
> > Subject: [aspectj-users] badWeaverState exception on iajc w/out prior 
> 
> > clean
> > 
> > Hello,
> > 
> > I am trying to compile junit tests and aspects in my application and 
> > keep running into a "bad WeaverState.Kind: -115" error when I 
> > recompile without cleaning all my source first. As rebuilding is 
> > obviously a bear to have to do each time I make a tweak, I'd love to 
> > learn why this occurs and how I can stop it.
> > 
> > I am using AspectJ 1.5.0, jdk1.5.0_02, ant 1.6.2.
> > 
> > Below are the iajc tag in my build.xml and the error output.
> > 
> > Any help/tips/corrections are greatly appreciated!
> > Thanks!
> > 
> > diane
> > 
> > 		<iajc srcdir="${test.src}" 
> > 			destdir="${test.classes}" 
> > 			deprecation="${compile.deprecation}"
> > 			debug="${compile.debug}"
> > 			source="1.5"
> > 			maxmem="640m"
> > 			fork="true">
> > 			<classpath>
> > 				... lots of jars ...
> > 			</classpath>
> > 			<inpath>
> > 				<pathelement location="some.jar"/>
> > 				<pathelement location="another.jar"/>
> > 				<pathelement location="${test.classes}"
> > />
> > 			</inpath>
> > 
> > 		</iajc>
> > 
> > 
> > compile-tests-with-aspects:
> >      [iajc] ABORT
> >      [iajc]
> >      [iajc] Exception thrown from AspectJ 1.5.0
> > 
> >      [iajc] This might be logged as a bug already -- find current 
> bugs
> 
> > at
> >      [iajc]
> >
> http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component
> > =Compiler
> > 
> >      [iajc] Bugs for exceptions thrown have titles File:line from the 
> 
> > top stack,
> > 
> >      [iajc] e.g., "SomeFile.java:243"
> > 
> >      [iajc] If you don't find the exception below in a bug, please 
> add
> 
> > a new bug
> > 
> >      [iajc] at
> >
> http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
> >      [iajc] To make the bug a priority, please include a test program
> >      [iajc] that can reproduce this exception.
> >      [iajc] bad WeaverState.Kind: -115
> > 
> >      [iajc] when batch building with classpath:
> > <classpath here>
> >      [iajc] bad WeaverState.Kind: -115
> >      [iajc] java.lang.RuntimeException: bad
> > WeaverState.Kind: -115
> >      [iajc]     at
> >
> org.aspectj.weaver.WeaverStateInfo.read(WeaverStateInfo.java:
> > 142)
> >      [iajc]     at
> > org.aspectj.weaver.AjAttribute.read(AjAttribute.java:98)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelAttributes.readAjAttributes(BcelA
> > ttributes.java:59)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelObjectType.unpackAspectAttributes
> > (BcelObjectType.java:273)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelObjectType.<init>(BcelObjectType.
> > java:134)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelWorld.makeBcelObjectType(BcelWorl
> > d.java:257)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelWorld.addSourceObjectType(BcelWor
> > ld.java:314)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelWeaver.addClassFile(BcelWeaver.ja
> > va:386)
> >      [iajc]     at
> >
> org.aspectj.weaver.bcel.BcelWeaver.addClassFile(BcelWeaver.ja
> > va:401)
> >      [iajc]     at
> >
> org.aspectj.ajdt.internal.core.builder.AjBuildManager.initBce
> > lWorld(AjBuildManager.java:658)
> >      [iajc]     at
> >
> org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild
> > (AjBuildManager.java:209)
> >      [iajc]     at
> >
> org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBu
> > ild(AjBuildManager.java:156)
> >      [iajc]     at
> >
> org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:1
> > 12)
> >      [iajc]     at
> >
> org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:
> > 60)
> >      [iajc]     at
> > org.aspectj.tools.ajc.Main.run(Main.java:326)
> >      [iajc]     at
> > org.aspectj.tools.ajc.Main.runMain(Main.java:240)
> >      [iajc]     at
> > org.aspectj.tools.ajc.Main.main(Main.java:83)
> > 
> > 
> >      [iajc] 1 fail|abort
> > 
> > BUILD FAILED
> > C:\views\yadda-yadda-yadda\build.xml:386:
> > failure[-1] running ajc
> > 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> > 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 



Back to the top