Closed KaiSuchomel closed 8 months ago
Are you sure that you picked up ArchUnit 1.2.0?
While I can reproduce the problem with ArchUnit ≤1.0.1, I cannot with ArchUnit ≥1.1.0.
The Rules we have created are using:
<dependency>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit-junit5</artifactId>
<version>1.2.0</version>
</dependency>
I have prepared a small quarkus project under: https://github.com/KaiSuchomel/quarkus_openapi/tree/issue/archunitWarningJDK21
When you excute mvn clean package
under JDK21 a lot of warnings occure in console:
[WARNING] Error during import from jrt:/java.base/java/lang/Object.class, falling back to simple import
java.lang.IllegalArgumentException: Unsupported class file major version 65
at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:199)
at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:180)
at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:166)
at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:287)
Perhaps its a problem in the arch-unit-maven-plugin
??
I finally found the Issue. The arch-unit-maven-plugin
with arch-unit-build-plugin-core
is using an older archunit (1.0.0).
With PR https://github.com/societe-generale/arch-unit-build-plugin-core/pull/73 the Issue is gone.
Cool; I'm glad that you could solve the problem! 🎉 Then I guess we can also close this issue?
1098, released with ArchUnit 1.1.0, has updated ASM to version 9.5, which had added support for Java 21.
Thank you for this @hankem, appreciated. :pray: Perhaps it would make sense to mention #1098 in the ArchUnit 1.1.0 release notes? Since it's such an important change, it deserves a bit more visibility IMO.
Okay, done.
Gonna close this issue for now, since it seems solved to me 🙂 Feel free to reopen if that's not the case...
well it is not the case with my setup and I don't use the plugin
00:48:10.193 [main] INFO com.tngtech.archunit.core.PluginLoader -- Detected Java version 21.0.1 00:48:10.490 [main] WARN com.tngtech.archunit.core.importer.ClassFileProcessor -- Couldn't import class from file:///.....class java.lang.IllegalArgumentException: Unsupported class file major version 65 at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init>(ClassReader.java:199) at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init>(ClassReader.java:180) at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init>(ClassReader.java:166) at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init>(ClassReader.java:287) at com.tngtech.archunit.core.importer.ClassFileProcessor.process(ClassFileProcessor.java:69) at com.tngtech.archunit.core.importer.ClassFileImporter.importLocations(ClassFileImporter.java:325) at com.tngtech.archunit.core.importer.ClassFileImporter.importPackages(ClassFileImporter.java:214) at com.tngtech.archunit.core.importer.ClassFileImporter.importPackages(ClassFileImporter.java:225)
@danyel: I recommend running "mvn dependency:tree" and searching for archunit. In my case I found out that another outdated dependency under dependencyManagement (in my case spring-modulith-bom) was referencing archunit 1.0.1 even tough I wanted to use 1.2.1.
Using ArchUnit 1.2.0 with Java 21 the following warning is produced:
[WARNING] Error during import from jrt:/java.base/java/lang/Integer.class, falling back to simple import java.lang.IllegalArgumentException: Unsupported class file major version 65 at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:199) at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:180) at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:166) at com.tngtech.archunit.thirdparty.org.objectweb.asm.ClassReader.<init> (ClassReader.java:287) at com.tngtech.archunit.core.importer.ClassFileProcessor$UriImporterOfProcessor.tryImport (ClassFileProcessor.java:329) at com.tngtech.archunit.core.importer.resolvers.ClassResolverFromClasspath.tryResolve (ClassResolverFromClasspath.java:51) at com.tngtech.archunit.core.importer.ImportedClasses.resolve (ImportedClasses.java:74) at com.tngtech.archunit.core.importer.ImportedClasses.ensurePresent (ImportedClasses.java:69) at com.tngtech.archunit.core.importer.DependencyResolutionProcess.executeRun (DependencyResolutionProcess.java:146) at com.tngtech.archunit.core.importer.DependencyResolutionProcess.resolve (DependencyResolutionProcess.java:122) at com.tngtech.archunit.core.importer.ClassGraphCreator.complete (ClassGraphCreator.java:99) at com.tngtech.archunit.core.importer.ClassFileProcessor.process (ClassFileProcessor.java:75) at com.tngtech.archunit.core.importer.ClassFileImporter.importLocations (ClassFileImporter.java:325) at com.tngtech.archunit.core.importer.ClassFileImporter.importPaths (ClassFileImporter.java:164) at com.tngtech.archunit.core.importer.ClassFileImporter.importPaths (ClassFileImporter.java:151) at com.tngtech.archunit.core.importer.ClassFileImporter.importPath (ClassFileImporter.java:134)
Whats causing this warning??
I found the Issues #230,#409 that had a similar "WARNING"