Bug 526707 - Java recursive generics cause AspectJ weaver to enter an infinite loop.
Summary: Java recursive generics cause AspectJ weaver to enter an infinite loop.
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.8.0   Edit
Hardware: PC Mac OS X
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-01 06:15 EDT by Emanuele Fusco CLA
Modified: 2020-05-11 04:04 EDT (History)
3 users (show)

See Also:


Attachments
Eclipse project to showcase the bug (5.33 KB, application/zip)
2017-11-01 06:15 EDT, Emanuele Fusco CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Fusco CLA 2017-11-01 06:15:17 EDT
Created attachment 271281 [details]
Eclipse project to showcase the bug

The AspectJ weaver enters an infinite loop which results in a StackOverflowError.
I provided a detailed description of the steps to replicate the bug on the StackOverflow developer website ( here a shortened link to the post https://goo.gl/mcmk7E ) and I am attaching a toy example showcasing the bug as an Eclipse project.


Below the information about my build environment (notice that I incurred in this bug first on a Linux machine with the OpenJDK):
eclipse.buildId=4.7.1.M20171009-0410
java.version=1.8.0_60
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -keyring /Users/emanuele/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -keyring /Users/emanuele/.eclipse_keyring

Full link to the StackOverflow post:
https://stackoverflow.com/questions/47030236/aspectj-compiler-bug-leads-to-stackoverfowerror?noredirect=1#comment81041099_47030236

And an extract of the error stack trace from the Eclipse log:

java.lang.StackOverflowError
	at java.lang.String.indexOf(String.java:1503)
	at org.aspectj.weaver.TypeFactory.createTypeFromSignature(TypeFactory.java:207)
	at org.aspectj.weaver.UnresolvedType.forSignature(UnresolvedType.java:397)
	at org.aspectj.weaver.UnresolvedType.getRawType(UnresolvedType.java:555)
	at org.aspectj.weaver.ResolvedType.getRawType(ResolvedType.java:2449)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:491)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:620)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:501)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.TypeVariable.isASubtypeOf(TypeVariable.java:201)
	at org.aspectj.weaver.TypeVariable.canBeBoundTo(TypeVariable.java:186)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:571)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:620)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.TypeVariable.isASubtypeOf(TypeVariable.java:201)
	at org.aspectj.weaver.TypeVariable.canBeBoundTo(TypeVariable.java:186)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:571)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:620)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.TypeVariable.isASubtypeOf(TypeVariable.java:201)
	at org.aspectj.weaver.TypeVariable.canBeBoundTo(TypeVariable.java:186)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:571)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:620)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:459)
	at org.aspectj.weaver.TypeVariable.isASubtypeOf(TypeVariable.java:201)
	at org.aspectj.weaver.TypeVariable.canBeBoundTo(TypeVariable.java:186)
...
Comment 1 Saha Bardo CLA 2018-02-23 15:35:43 EST
How in Earth you guys manage to sleep without fixing this bug?
Comment 2 Tim Wright CLA 2020-05-11 01:12:26 EDT
(In reply to Saha Bardo from comment #1)
> How in Earth you guys manage to sleep without fixing this bug?

I'm sure they're doing their best! While this bug is stopping my project using aspectJ, it's free software so let's be nice.
Comment 3 Tim Wright CLA 2020-05-11 01:18:46 EDT
Note: I fixed my environment by upgrading to 1.9.5 of aspectjrt.
Comment 4 Saha Bardo CLA 2020-05-11 04:04:05 EDT
(In reply to Tim Wright from comment #2)
> (In reply to Saha Bardo from comment #1)
> > How in Earth you guys manage to sleep without fixing this bug?
> 
> I'm sure they're doing their best! While this bug is stopping my project
> using aspectJ, it's free software so let's be nice.

You are right Tim. I am sorry. It was intended to tease the bug reporter (friend of mine) but then I forgot to edit or remove it.