Community
Participate
Working Groups
Created attachment 218907 [details] part of the ajcore...txt file In my pom.xml I have : ... <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <XnoInline>true</XnoInline> <aspectLibraries> <aspectLibrary> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </aspectLibrary> </aspectLibraries> <verbose>true</verbose> <showWeaveInfo>true</showWeaveInfo> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> ... <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.6.7</version> </dependency> ... At aspectj:test-compile maven step (strange that I do not get it under aspectj:compile) I get java.lang.StackOverflowError. I have only a single aspect which has a number of @Ppointcuts and a number of @DeclareErrors (no advises) like: @Aspect public class YyyArchitectureValidator { @Pointcut("within(com.xxx.yyy.facade.amqp..*)") public void inAmqpFacade() { } @Pointcut("within(com.xxx.yyy.facade.rest..*)") public void inRestFacade() { } @Pointcut("inAmqpFacade() || inRestFacade()") public void inPresentationLayer() { } @Pointcut("within(com.xxx.yyy.domainmodel..*)") public void inDomainModelLayer() { } @DeclareError("inDomainModelLayer() && presentationLayerCall()") static final String domainModelLayerCannotCallPresentationLayer = "Domain Model Layer cannot call Presentaion Layer!"; I see into the exception stack that there is the same pattern which occurs many times: at org.aspectj.weaver.bcel.BcelWorld.buildBcelDelegate(BcelWorld.java:382) at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate(BcelWorld.java:377) at org.aspectj.weaver.World.resolveToReferenceType(World.java:411) at org.aspectj.weaver.World.resolve(World.java:296) at org.aspectj.weaver.World.resolve(World.java:209) at org.aspectj.weaver.UnresolvedType.resolve(UnresolvedType.java:645) at org.aspectj.weaver.ResolvedMemberImpl.isVisible(ResolvedMemberImpl.java:631) at org.aspectj.weaver.patterns.ReferencePointcut.resolveBindings(ReferencePointcut.java:173) at org.aspectj.weaver.patterns.AndPointcut.resolveBindings(AndPointcut.java:75) at org.aspectj.weaver.patterns.Pointcut.resolve(Pointcut.java:186) at org.aspectj.weaver.patterns.DeclareErrorOrWarning.resolve(DeclareErrorOrWarning.java:102) at org.aspectj.weaver.bcel.BcelObjectType.resolveAnnotationDeclares(BcelObjectType.java:464) at org.aspectj.weaver.bcel.BcelObjectType.ensureAspectJAttributesUnpacked(BcelObjectType.java:397) at org.aspectj.weaver.bcel.BcelObjectType.<init>(BcelObjectType.java:159) Note that I have tried using aspectjrt 1.6.8, 1.6.12 and 1.7.0 under win7 and ubuntu and I always got the same error. The full exception trace is attached
Also tried increasing memory via MAVEN_OPTS=-Xms512m -Xmx1024m -XX:MaxPermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC but got the same error
some more pointcuts from this Aspect @Pointcut("call(* com.vmware.hcs.facade.amqp..*.*(..))") public void amqpFacadeCall() { } @Pointcut("call(* com.vmware.hcs.facade.rest..*.*(..))") public void restFacadeCall() { } @Pointcut("amqpFacadeCall() || restFacadeCall()") public void presentationLayerCall() { }
This bug looks awfully similar to bug 364380, which was fixed in AspectJ 1.7.0. I recreated the issue with your testcode below on 1.6.7 then tried it on 1.6.12, still failed, then tried it on 1.7.0 - and it started working. Are you absolutely sure you tried it on the 1.7.0 release? If so, can you attach an ajcore from that release so I can verify the line numbers. thanks!
Created attachment 220434 [details] ajcore.txt using aspectjrt-1.7.0.jar I get this dump most of the time
Created attachment 220437 [details] ajcore.txt using aspectjrt-1.7.0.jar - this was a single shot.. a different one
I have attached (ajcore.2.txt) a dump using 1.7.0. Thanks.
Hi. It isn't about what version of aspectjrt.jar you use as the error is coming from the compiler/weaver, not during runtime - if you look at the first two lines of the ajcore files you have attached, you will see it is still using AspectJ 1.6.7 (compiler or weaver jar). Can you change the compiler version you are using to 1.7.0?
I see. I have removed the dependency on aspectjrt and added <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>1.7.0</version> </dependency> but I again get ---- AspectJ Properties --- AspectJ Compiler 1.6.7 built on Friday Jan 1, 2010 at 03:49:38 GMT into the dump. I'm not sure how aspectj-maven-plugin decides which version of ajc to use. Do you have any idea how to ? Also is it posible to use ajc 1.7.0 with jdk 1.6?
I'm no maven expert but in the example I was just looking at I see that the dependency block is inside the plugin block for the aspectj-maven-plugin: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.2</version> <configuration> <outxml>true</outxml> <aspectLibraries> <aspectLibrary> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> </aspectLibrary> <aspectLibrary> <groupId>org.springframework.data</groupId> <artifactId>spring-data-neo4j-aspects</artifactId> </aspectLibrary> </aspectLibraries> <source>1.6</source> <target>1.6</target> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>${aspectj.version}</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>${aspectj.version}</version> </dependency> </dependencies> </plugin> maybe try that? > Also is it posible to use ajc 1.7.0 with jdk 1.6? Yep, AspectJ 1.7.0 supports source/target 1.6/1.5/1.4 - the java runtime required to execute AspectJ is 1.5 or later.
I see that you can configure the (AspectJ Compiler) ajc version into the aspectj-maven-plugin via dependency block inside the plugin block. It seems that you are a maven expert too :) Thanks! I have tested it with 1.7.0 - there is no problem! (With 1.6.12, 1.6.11 the problem is present) Thanks!
believed fixed in the 1.7 stream