Bug 321280 - StackOverflowError with aspectJ 1.6.8
Summary: StackOverflowError with aspectJ 1.6.8
Status: RESOLVED DUPLICATE of bug 314984
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.6.10   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-29 20:47 EDT by minalenan CLA
Modified: 2010-08-25 13:19 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description minalenan CLA 2010-07-29 20:47:29 EDT
Build Identifier: 

*Environment*
OS name: "linux" version: "2.6.18-164.11.1.el5" arch: "i386" Family: "unix"
Apache Maven 2.2.1
Java version: 1.6.0_19

*Related Plugin & Libraries*
aspectj-maven-plugin: 1.3
spring-aspects: 3.0.3.RELEASE

I've seen that this problem is reported as fixed in 1.6.8 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=309761). However, I still get this error.
Any help would be appreciated!  Thank you.

*Log messages*
[INFO] [aspectj:compile {execution: default}]
[WARNING] bad version number found in /home/devadmin/.m2/repository/org/aspectj/aspectjrt/1.6.8/aspectjrt-1.6.8.jar expected 1.6.7 found 1.6.8
[ERROR] trouble in: 
public class com.xxx.service.common.CacheLinkedHashMap extends java.util.LinkedHashMap:
  private int maxCapacity
  protected boolean removeEldestEntry(java.util.Map$Entry)    org.aspectj.weaver.MethodDeclarationLineNumber: 9:228
:
    method-execution(boolean com.xxx.service.common.CacheLinkedHashMap.removeEldestEntry(java.util.Map$Entry))
    |               ALOAD_0     // Lcom/xxx/service/common/CacheLinkedHashMap; this   (line 10)
    | method-call(int com.xxx.service.common.CacheLinkedHashMap.size())
    | |             INVOKEVIRTUAL com.xxx.service.common.CacheLinkedHashMap.size ()I
    | method-call(int com.xxx.service.common.CacheLinkedHashMap.size())
    |               ALOAD_0     // Lcom/xxx/service/common/CacheLinkedHashMap; this
    |               GETFIELD com.xxx.service.common.CacheLinkedHashMap.maxCapacity I
    |               IF_ICMPLE L0
    |               ICONST_1
    |               IRETURN
    |           L0: ICONST_0
    |               IRETURN
    method-execution(boolean com.xxx.service.common.CacheLinkedHashMap.removeEldestEntry(java.util.Map$Entry))
  end protected boolean removeEldestEntry(java.util.Map$Entry)

...
...

 -- (StackOverflowError) null
null
java.lang.StackOverflowError
	at java.util.WeakHashMap.get(WeakHashMap.java:348)
	at java.util.Collections$SynchronizedMap.get(Collections.java:1975)
	at org.aspectj.weaver.World$TypeMap.get(World.java:1119)
	at org.aspectj.weaver.World.resolve(World.java:273)
	at org.aspectj.weaver.World.resolve(World.java:209)
	at org.aspectj.weaver.UnresolvedType.resolve(UnresolvedType.java:645)
	at org.aspectj.weaver.ResolvedType.getRawType(ResolvedType.java:2331)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:427)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:393)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:427)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:393)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:427)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:393)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:427)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:393)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:427)

Reproducible: Sometimes

Steps to Reproduce:
It's not happening all the time. All I do is using the command "mvn clean package".
Comment 1 Andrew Clement CLA 2010-07-29 21:33:33 EDT
The 1.6.8 release notes describe the issue:

http://eclipse.org/aspectj/doc/released/README-168.html

It is fixed in 1.6.8.

*** This bug has been marked as a duplicate of bug 314984 ***
Comment 2 minalenan CLA 2010-07-30 12:58:42 EDT
I'm using 1.6.8 but it's still happening.


(In reply to comment #1)
> The 1.6.8 release notes describe the issue:
> 
> http://eclipse.org/aspectj/doc/released/README-168.html
> 
> It is fixed in 1.6.8.
> 
> *** This bug has been marked as a duplicate of bug 314984 ***
Comment 3 Andrew Clement CLA 2010-07-30 13:35:06 EDT
hmmm, can you attach the full log showing it happening with 1.6.8? (You could also try 1.6.9)
Comment 4 Matt McHenry CLA 2010-08-10 08:38:38 EDT
I wonder if you only think you're using a later version.  See bug 230053.  I think I may be in exactly the same boat with my maven config.  I'll post back here if I figure it out; the other bug is light on details.
Comment 5 Matt McHenry CLA 2010-08-10 13:18:36 EDT
A change like this in my <pluginManagement/> section made the warning (and the error) go away, so presumably I'm now at 1.6.9 for real:

@@ -94,6 +94,13 @@
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>aspectj-maven-plugin</artifactId>
           <version>1.3</version>
+          <dependencies>
+            <dependency>
+              <groupId>org.aspectj</groupId>
+              <artifactId>aspectjtools</artifactId>
+              <version>1.6.9</version>
+            </dependency>
+          </dependencies>
         </plugin>

This is necessary because the aspectj-maven-plugin's POM declares this dependency with a version of 1.6.7.
Comment 6 Andrew Clement CLA 2010-08-10 13:23:49 EDT
thanks for the tip Matt, I'll remember that.
Comment 7 minalenan CLA 2010-08-11 17:56:47 EDT
Thank you All for comments.

Unfortunately there is not much more in the full log, other than what I originally posted.
There were just repetitive messages of
[ERROR] trouble in: 
public class com.xxx.service.common.CacheLinkedHashMap extends
java.util.LinkedHashMap:
  private int maxCapacity
  protected boolean removeEldestEntry(java.util.Map$Entry)   
org.aspectj.weaver.MethodDeclarationLineNumber: 9:228

it kept going on for many many classes..
and at the end, there were just StackOverflowError messages.


I'm pretty sure that I'm on AspectJ 1.6.8.  My pom explicitly specifies aspectj version.

<properties>
<aspectj.version>1.6.8</aspectj.version>
...
</properties>

...
<dependency>
 <groupId>org.aspectj</groupId>
 <artifactId>aspectjweaver</artifactId>
 <version>${aspectj.version}</version>
</dependency>

<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>

...

And for the aspectj maven plugin, I do not have <pluginManagement>; I only have the plugin configuration.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>aspectj-maven-plugin</artifactId>
  <configuration>
    <complianceLevel>1.6</complianceLevel>
    <aspectLibraries>
      <aspectLibrary>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
      </aspectLibrary>
    </aspectLibraries>
  </configuration>
  <executions>
    <execution>
      <goals>
        <goal>compile</goal>
      </goals>
    </execution>
  </executions>
</plugin>


Right now, I rolled back to 1.6.6 to avoid the error. I'll try 1.6.9 with Matt's suggestion.

Thanks again!
Comment 8 Andrew Clement CLA 2010-08-25 13:19:22 EDT
Under bug 323417 we found another way to cause this exception.  The fix is now in the latest build snapshots.  If you wanted to try it, you  will need this maven repo:

<repository>
    <id>maven.springframework.org</id>
    <name>SpringSource snapshots</name>
    <url>http://maven.springframework.org/snapshot</url>
</repository>

and to depend on AspectJ version of aspectjtools/weaver/runtime: 

1.6.10.BUILD-SNAPSHOT