Bug 567657 - Old JAR on classpath breaks ajc, where target>=9, jar<=1.8
Summary: Old JAR on classpath breaks ajc, where target>=9, jar<=1.8
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.9.5   Edit
Hardware: PC Windows 10
: P3 blocker (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-07 01:50 EDT by Paul Dillon CLA
Modified: 2020-10-07 03:38 EDT (History)
1 user (show)

See Also:


Attachments
Maven project that reproduces the problem (39.20 KB, application/x-zip-compressed)
2020-10-07 01:50 EDT, Paul Dillon CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Dillon CLA 2020-10-07 01:50:50 EDT
Created attachment 284383 [details]
Maven project that reproduces the problem

Ajc is unable to resolve java.lang.* classes when the classpath contains an old jar compiled with 1.7 or 1.8.  Adding/removing import statements seems to resolve the issue, though it not a useful workaround.

I've attached a sample project that reproduces the problem.  See the comments in the Target and Module2PoJo classes regarding imports.

I reproduced the problem on 1.9.5, 1.9.6 and 1.9.7-SNAPSHOT, and Java 9, 13, and 14.

The old jar is net.openhft:affinity-2.2.jar, compiled with Java 1.7.

Maven/ajc output:

[DEBUG] Running : ajc -Xajruntimetarget:1.5 -9 -encoding UTF-8 -showWeaveInfo -source 9 -target 9 -verbose -classpath C:\Paul\Work\ajc-demo\ajc-module1\target\ajc-module1-0.1-SNAPSHOT.jar;C:\Users\psdil\.m2\repository\org\aspectj\aspectjtools\1.9.5\aspectjtools-1.9.5.jar;C:\Users\psdil\.m2\repository\org\aspectj\aspectjweaver\1.9.5\aspectjweaver-1.9.5.jar;C:\Users\psdil\.m2\repository\org\aspectj\aspectjrt\1.9.5\aspectjrt-1.9.5.jar;C:\Users\psdil\.m2\repository\net\openhft\affinity\2.2\affinity-2.2.jar;C:\Users\psdil\.m2\repository\org\slf4j\slf4j-api\1.7.6\slf4j-api-1.7.6.jar;C:\Users\psdil\.m2\repository\net\java\dev\jna\jna\4.1.0\jna-4.1.0.jar;C:\Users\psdil\.m2\repository\net\java\dev\jna\jna-platform\4.1.0\jna-platform-4.1.0.jar;C:\Users\psdil\.m2\repository\org\kohsuke\jetbrains\annotations\9.0\annotations-9.0.jar;C:\Paul\Work\ajc-demo\ajc-module2\target\classes -aspectpath C:\Paul\Work\ajc-demo\ajc-module1\target\ajc-module1-0.1-SNAPSHOT.jar -d C:\Paul\Work\ajc-demo\ajc-module2\target\classes -s C:\Paul\Work\ajc-demo\ajc-module2\target\generated-sources\aspectj-maven-plugin C:\Paul\Work\ajc-demo\ajc-module2\src\main\java\com\thinkingape\ajc\module2\Module2Pojo.java C:\Paul\Work\ajc-demo\ajc-module2\src\main\java\com\thinkingape\ajc\module2\Target.java
[DEBUG] Compiling and weaving 2 sources to C:\Paul\Work\ajc-demo\ajc-module2\target\classes
[DEBUG] Arguments file written : C:\Paul\Work\ajc-demo\ajc-module2\target\classes\builddef.lst
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[DEBUG] Pipelining compilation
[DEBUG] compiling C:\Paul\Work\ajc-demo\ajc-module2\src\main\java\com\thinkingape\ajc\module2\Module2Pojo.java
[DEBUG] weaver operating in reweavable mode.  Need to verify any required types exist.
[DEBUG] woven class com.thinkingape.ajc.module2.Module2Pojo (from C:\Paul\Work\ajc-demo\ajc-module2\src\main\java\com\thinkingape\ajc\module2\Module2Pojo.java)
[DEBUG] compiling C:\Paul\Work\ajc-demo\ajc-module2\src\main\java\com\thinkingape\ajc\module2\Target.java
[ERROR] The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
	C:\Paul\Work\ajc-demo\ajc-module2\src\main\java\com\thinkingape\ajc\module2\Target.java:1
(no source information available)