Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞: AspectJ is incompatible with Java 23 #1149

Closed
1 task done
danishnawab opened this issue Jan 8, 2025 · 4 comments
Closed
1 task done

🐞: AspectJ is incompatible with Java 23 #1149

danishnawab opened this issue Jan 8, 2025 · 4 comments

Comments

@danishnawab
Copy link

What happened?

AspectJ is incompatible with Java 23 and is generally unmaintained.

As a result, Allure is also incompatible with Java 23 (as it depends on AspectJ).
The following exception is encountered when executing tests with allure:

Logs

Exception

java.lang.RuntimeException: The aspect weaver cannot determine any valid method to define auxiliary classes in arbitrary class loaders. Aspect weaving will *not* work, and you will see subsequent errors. Please search for corresponding issues at https://github.com/eclipse-aspectj/aspectj/issues. If there are none, please create a new one.
     at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.<clinit>(ClassLoaderWeavingAdaptor.java:1043)
     at org.aspectj.weaver.loadtime.Aj.<clinit>(Aj.java:267)
     at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.<clinit>(ClassPreProcessorAgentAdapter.java:27)
     at org.aspectj.weaver.loadtime.Agent.<clinit>(Agent.java:34)
     at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
     at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1161)
     at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:340)
     at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newMethodAccessor(MethodHandleAccessorFactory.java:71)
     at java.base/jdk.internal.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:154)
     at java.base/java.lang.reflect.Method.acquireMethodAccessor(Method.java:726)
     at java.base/java.lang.reflect.Method.invoke(Method.java:577)
     at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:560)
     at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:572)          
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 67
     at aj.org.objectweb.asm.ClassReader.<init>(ClassReader.java:200)
     at aj.org.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
     at aj.org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
     at aj.org.objectweb.asm.ClassReader.<init>(ClassReader.java:288)
     at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.getMirrorClassBytes(ClassLoaderWeavingAdaptor.java:1180)
     at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.getMirrorClass(ClassLoaderWeavingAdaptor.java:1166)
     at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.getAccessibleObjectOverrideOffset(ClassLoaderWeavingAdaptor.java:1128)
     at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.createDefineClassMethodHandle(ClassLoaderWeavingAdaptor.java:1100)
     at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.<clinit>(ClassLoaderWeavingAdaptor.java:1040)
     ... 12 more

Are there plans to mitigate this problem and make Allure compatible with Java 23 (and future Java versions)?

What Allure Integration are you using?

allure-junit5

What version of Allure Integration you are using?

2.29.1

What version of Allure Report you are using?

2.29.1

Code of Conduct

  • I agree to follow this project's Code of Conduct
@danishnawab danishnawab added triage type:bug Something isn't working labels Jan 8, 2025
@baev
Copy link
Member

baev commented Jan 8, 2025

AspectJ isn't required for Allure to work. You can use Runtime API methods instead of @Step and @Attachment annotations, see https://allurereport.org/docs/junit5-reference/#test-steps and https://allurereport.org/docs/junit5-reference/#attachments

As AspectJ is an important part of the Java Exosystem, I do believe that the community will find the funds to support the project.

@baev baev closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2025
@baev baev removed type:bug Something isn't working triage labels Jan 8, 2025
@danishnawab
Copy link
Author

Since @Step doesn't currently work with Java 23, I would argue that AspectJ is required for Allure to work fully.

My question was more along the lines of whether there are any plans to migrate away from AspectJ to a different implementation/library.

Or does Allure accept that the annotation-style APIs are not going to work with modern Java versions as long as AspectJ doesn't find a solution for them?

@baev
Copy link
Member

baev commented Jan 8, 2025

Unfortunately, there are no suitable alternatives for AspectJ. Java 23 is only a few months old, so I would give the libraries some time to support it.

As I said, AspectJ is an essential part of the Java Ecosystem. We'll be fine.

@danishnawab
Copy link
Author

Hopefully, yes.
Thank you for your quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants