jQAssistant / Idea-Hub

Hub to propose and discuss new ideas, features, as well as general issues
0 stars 0 forks source link

Java 16 binaries cannot be scanned (Unsupported class file major version 60) #21

Closed lostiniceland closed 3 years ago

lostiniceland commented 3 years ago

In preparation for the upcoming Java LTS 17, supporting the scanning of Java 16 would be nice.

At the moment the result is this

2021-07-12 14:51:22.414 [main] WARN ClassFileScannerPlugin - Cannot scan class 'MyClass.class'.
java.lang.IllegalArgumentException: Unsupported class file major version 60
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:196)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:177)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:163)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:284)
        at com.buschmais.jqassistant.plugin.java.impl.scanner.ClassFileScannerPlugin.lambda$scan$0(ClassFileScannerPlugin.java:66)
        at com.buschmais.jqassistant.plugin.common.api.scanner.MD5DigestDelegate.digest(MD5DigestDelegate.java:79)
        at com.buschmais.jqassistant.plugin.java.impl.scanner.ClassFileScannerPlugin.scan(ClassFileScannerPlugin.java:65)
        at com.buschmais.jqassistant.plugin.java.impl.scanner.ClassFileScannerPlugin.scan(ClassFileScannerPlugin.java:27)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:120)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:84)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
        at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin.scan(AbstractContainerScannerPlugin.java:53)
        at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin.scan(AbstractContainerScannerPlugin.java:29)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:120)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:84)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
        at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractZipArchiveScannerPlugin.scan(AbstractZipArchiveScannerPlugin.java:51)
        at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractZipArchiveScannerPlugin.scan(AbstractZipArchiveScannerPlugin.java:21)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:120)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:84)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
        at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin.scan(AbstractContainerScannerPlugin.java:53)
        at com.buschmais.jqassistant.plugin.common.api.scanner.AbstractContainerScannerPlugin.scan(AbstractContainerScannerPlugin.java:29)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:120)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:80)
        at com.buschmais.jqassistant.core.scanner.impl.ScannerImpl.scan(ScannerImpl.java:59)
        at com.buschmais.jqassistant.commandline.task.ScanTask.scan(ScanTask.java:96)
        at com.buschmais.jqassistant.commandline.task.ScanTask.executeTask(ScanTask.java:77)
        at com.buschmais.jqassistant.commandline.task.AbstractStoreTask.run(AbstractStoreTask.java:50)
        at com.buschmais.jqassistant.commandline.Main.executeTask(Main.java:254)
        at com.buschmais.jqassistant.commandline.Main.executeTasks(Main.java:203)
        at com.buschmais.jqassistant.commandline.Main.interpretCommandLine(Main.java:195)
        at com.buschmais.jqassistant.commandline.Main.run(Main.java:78)
        at com.buschmais.jqassistant.commandline.Main.main(Main.java:49)
obfischer commented 3 years ago

Hi @lostiniceland,

I will have today a look if can simply switch to the latest ASM version. If yes, I would prepare a release candidate for a new version of JQA.

DirkMahler commented 3 years ago

jQA 1.10.0 should be able to read Java 17 classes (it comes with ASM 9.1 which according to https://asm.ow2.io/versions.html should support it).

@lostiniceland: Which jQA version and distribution (Maven or CLI) are you using?

lostiniceland commented 3 years ago

1.9.1 which was referenced in the Getting-Started CLI section

DirkMahler commented 3 years ago

Can you try with 1.10.0? The getting started page has been updated.

obfischer commented 3 years ago

@DirkMahler The guide should mention, that there might be a more recent version of jQA.

obfischer commented 3 years ago

@DirkMahler Maybe we should consider a 1.11.0 with support for JDK 18 by only updating the ASM version we use?

lostiniceland commented 3 years ago

@DirkMahler I can confirm that 1.10.0 works with Java 16 (after fixing the cli shell with the solution mentioned here)

DirkMahler commented 3 years ago

@obfischer It's updating the dependency as well as (possibly) increasing the ASM API version in the VisitorHelper of the Java plugin.

@lostiniceland I adopted the hint in the getting started page (sadly we cannot link directly to the latest distribution).

obfischer commented 3 years ago

@DirkMahler We could use this link to Maven Central Repository Search: https://search.maven.org/artifact/com.buschmais.jqassistant/jqa-uber-parent

lostiniceland commented 3 years ago

Closing, as 1.10.0 solves the issue

obfischer commented 3 years ago

The next version will use ASM 9.2 and will be able to scan also Java 18 bytecode.