Bug 582832 - BaseProcessingEnvImpl.java:49 java.lang.NoSuchFieldError: RELEASE_17
Summary: BaseProcessingEnvImpl.java:49 java.lang.NoSuchFieldError: RELEASE_17
Status: CLOSED INVALID
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-05 08:03 EST by David Georg Reichelt CLA
Modified: 2024-01-05 09:00 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Georg Reichelt CLA 2024-01-05 08:03:49 EST
We used AspectJ 1.9.19, which was running perfectly. Now, we wanted to update to 1.9.21 for JDK 21 compatibility, but unfortunately, this leads to an exception:

when batch building BuildConfig[null] #Files=0 AopXmls=#0
RELEASE_17
java.lang.NoSuchFieldError: RELEASE_17
	at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.BaseProcessingEnvImpl.<clinit>(BaseProcessingEnvImpl.java:49)
	at org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.BatchAnnotationProcessorManager.configure(BatchAnnotationProcessorManager.java:79)
	at org.aspectj.org.eclipse.jdt.internal.compiler.batch.Main.initializeAnnotationProcessorManager(Main.java:4677)
	at org.aspectj.ajdt.ajc.BuildArgParser.initializeAnnotationProcessorManager(BuildArgParser.java:314)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1070)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:275)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:188)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:103)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:47)
	at org.aspectj.tools.ajc.Main.run(Main.java:374)
	at org.aspectj.tools.ajc.Main.runMain(Main.java:253)
	at org.aspectj.tools.ajc.Main.main(Main.java:84)

The problem occured here: https://github.com/kieker-monitoring/kieker/actions/runs/7421484999/job/20194928410 I am locally running Ubuntu 22.04 with OpenJDK 11, but I assume that this happens on JDK 11 regardless of the OS.

The problem occurs when just cloning (git clone https://github.com/kieker-monitoring/kieker.git), and then running ./gradlew compileJava. Since we internally do not use this field, I assume that this has something to do with either the AspectJ compiler itself or the aspectj Gradle plugin (https://plugins.gradle.org/plugin/io.freefair.aspectj - we use the newest version 8.4).

It seems like the file where this occurs is https://github.com/eclipse-jdt/eclipse.jdt.core/blob/33ad538b4d523b0fbc99b99d17222e846ec1893a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BaseProcessingEnvImpl.java#L49 The SourceVersion.RELEASE_17 is not available in Java 11, so this fails. 

As far as I see it, the JDT Core would need to downgrade this to RELEASE_11, or AspectJ needs to state that 1.9.21 is only runnable with Java 17+. According to https://github.com/eclipse-aspectj/aspectj/blob/master/docs/dist/doc/JavaVersionCompatibility.md, AspectJ should also work with Java 8+, which seems not to be true.

Is there any solution / workaround for this problem?
Comment 1 David Georg Reichelt CLA 2024-01-05 08:59:48 EST
This has already been discussed in https://github.com/eclipse-aspectj/aspectj/issues/269, and I didn't read this carefully enough - JDK 11 is not supported during build time, but during compile time.