GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — CLI with JDK 17 throws Unsupported class file major version 61 · Issue #373 · UnitTestBot/UTBotJava

CLI with JDK 17 throws Unsupported class file major version 61 #373

New issue
Copy link
New issue
Copy link
Closed
#890
Closed
CLI with JDK 17 throws Unsupported class file major version 61#373
#890
Copy link
Assignees
sergeypospelov
Labels
ctg-bugIssue is a bugIssue is a bugpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev teamstatus-verifiedBug fix is verifiedBug fix is verified
Milestone
2022.10 Release preparation

Description

@alisevych
alisevych
opened on Jul 1, 2022
Issue body actions

Description

CLI with JDK 17
Soot throws "IllegalArgumentException: Unsupported class file major version 61" when called from CLI with JDK 17.

To Reproduce

Steps to reproduce the behavior:

  1. Define JDK-17 as primary (Path, JAVA_HOME)
  2. Download one of the latest CLI from master
  3. For simplicity in the folder where utbot-cli*.jar is located :
    Create ExampleString.java using var (feature introduced in Java 9)
public class ExampleString {

    public void stringNewMethod() {
        var text = "Hello! This is String defined with var";

        text = text.toLowerCase();
        System.out.println(text);

        text = text.toUpperCase();
        System.out.println(text);
    }
}
  1. Create ExampleRecord.java using record (feature introduced in Java 16)
public class ExampleRecord {

    public record Person(String name, int age) {
        public Person {
            if(age < 0) {
                throw new IllegalArgumentException("Age cannot be negative");
            }
        }
    }
}

  1. Compile your files with JDK-17

javac ExampleRecord.java
javac ExampleString.class

  1. Run utbot-cli to generate tests for it, like that:

java -jar utbot-cli-2022.7.jar generate --source ExampleString.java --classpath "D:\Current\Java" -o ExampleStringTest.java ExampleString

java -jar utbot-cli-2022.7.jar generate --source ExampleRecord.java --classpath "D:\Current\Java" -o ExampleRecordTest.java ExampleRecord

Expected behavior

Tests are supposed to be generated.

Actual behavior

There is the following output in console:

WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
16:14:54.331 | INFO  | AllInMemoryClassProvider | Loaded: 2 path entries, 48 classes, 196740 bytes
16:14:54.378 | ERROR | GenerateTestsCommand | An error has occurred while generating test for snippet ExampleRecord : java.lang.IllegalArgumentException: Unsupported class file major version 61
java.lang.IllegalArgumentException: Unsupported class file major version 61
        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 soot.asm.AsmClassSource.resolve(AsmClassSource.java:64)
        at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:253)
        at soot.SootResolver.bringToHierarchy(SootResolver.java:221)
        at soot.SootResolver.bringToSignatures(SootResolver.java:292)
        at soot.SootResolver.bringToBodies(SootResolver.java:332)
        at soot.SootResolver.processResolveWorklist(SootResolver.java:171)
        at soot.SootResolver.resolveClass(SootResolver.java:141)
        at soot.Scene.tryLoadClass(Scene.java:965)
        at soot.Scene.loadBasicClasses(Scene.java:1670)
        at soot.Scene.loadNecessaryClasses(Scene.java:1770)
        at org.utbot.framework.plugin.api.SootUtilsKt.runSoot(SootUtils.kt:77)
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.init(UtBotTestCaseGenerator.kt:111)
        at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.init(UtBotTestCaseGenerator.kt:75)
        at org.utbot.cli.GenerateTestsAbstractCommand.initializeEngine(GenerateTestsAbstractCommand.kt:202)
        at org.utbot.cli.GenerateTestsCommand.run(GenerateTestsCommand.kt:95)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:204)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:213)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:17)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:396)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:393)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:411)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:436)
        at org.utbot.cli.ApplicationKt.main(Application.kt:31)

Activity

  1. alisevych
    added
    ctg-bugIssue is a bugIssue is a bug
    priority-top-focusTop priority chosen by dev teamTop priority chosen by dev team
    on Jul 1, 2022
  2. alisevych
    assigned
    sergeypospelov
    on Jul 1, 2022
  3. nikitavlaev
    added a commit that references this issue on Jul 1, 2022

    Add title pane with unsupported jdk notification (#373)

    154115b
  4. sergeypospelov commented on Jul 4, 2022

    @sergeypospelov
    sergeypospelov
    on Jul 4, 2022
    Member
    More actions

    Some investigation on #373:

    It happens, because our Soot has a low dependency on ASM library.

    Potential fix:

    • add a dependency on a higher ASM version

    Will try this out

  5. nikitavlaev
    added 2 commits that reference this issue on Jul 4, 2022

    Add title pane with unsupported jdk notification (#373)

    7c1c49e

    Add title pane with unsupported jdk notification (#373)

    a805f31
  6. alexeyfridman
    added this to UTBot Javaon Jul 6, 2022
  7. alexeyfridman
    moved this to Todo in UTBot Javaon Jul 6, 2022
  8. alexeyfridman
    moved this from Todo to Done in UTBot Javaon Jul 6, 2022
  9. alexeyfridman
    moved this from Done to In Progress in UTBot Javaon Jul 6, 2022
  10. dtim commented on Jul 8, 2022

    @dtim
    dtim
    on Jul 8, 2022
    Collaborator
    More actions

    Related: UnitTestBot does not work on Idea 2022.2 EAP, as it uses JBR 17 as its runtime.

    Environment
    IntelliJ IDEA 2022.2 Beta (Ultimate Edition)
    Build #IU-222.3345.16, built on July 7, 2022
    Expiration date: August 6, 2022
    Runtime version: 17.0.3+7-b469.19 amd64
    VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
    Linux 5.13.0-52-generic
    GC: G1 Young Generation, G1 Old Generation
    Memory: 16384M
    Cores: 16
    Non-Bundled Plugins:
    com.jetbrains.grayTheme (1.3)
    org.utbot.intellij.plugin.id (2022.7-beta)

    Kotlin: 222-1.7.0-release-282-IJ3345.16
    Current Desktop: ubuntu:GNOME

    Actual behavior
    No tests are generated, the following exception is thrown:

    java.lang.IllegalArgumentException: Unsupported class file major version 61
    	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 soot.asm.AsmClassSource.resolve(AsmClassSource.java:64)
    	at soot.SootResolver.bringToHierarchyUnchecked(SootResolver.java:253)
    	at soot.SootResolver.bringToHierarchy(SootResolver.java:221)
    	at soot.SootResolver.bringToSignatures(SootResolver.java:292)
    	at soot.SootResolver.bringToBodies(SootResolver.java:332)
    	at soot.SootResolver.processResolveWorklist(SootResolver.java:171)
    	at soot.SootResolver.resolveClass(SootResolver.java:141)
    	at soot.Scene.tryLoadClass(Scene.java:965)
    	at soot.Scene.loadBasicClasses(Scene.java:1670)
    	at soot.Scene.loadNecessaryClasses(Scene.java:1770)
    	at org.utbot.framework.plugin.api.SootUtilsKt.runSoot(SootUtils.kt:80)
    	at org.utbot.framework.plugin.api.UtBotTestCaseGenerator.init(UtBotTestCaseGenerator.kt:111)
    	at org.utbot.intellij.plugin.generator.CodeGenerator.<init>(CodeGenerator.kt:44)
    	at org.utbot.intellij.plugin.generator.CodeGenerator.<init>(CodeGenerator.kt:36)
    	at org.utbot.intellij.plugin.ui.UtTestsDialogProcessor$createTests$2$1.run(UtTestsDialogProcessor.kt:157)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
    	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
    	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
    	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
    	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
    	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
    	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
    	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
    	at java.base/java.lang.Thread.run(Thread.java:833)
    
    Reacted by Alena Lisevych
    Reacted by Sergey Pospelov
  11. rudolf101
    added a commit that references this issue on Jul 8, 2022

    Squashed commit of the following:

    bf2e0e7
  12. alisevych
    added this to the Release preparation milestone on Sep 7, 2022
  13. sergeypospelov
    added a commit that references this issue on Sep 14, 2022

    Update Soot and choose an analyzable JRE #373 (#890)

    dc6b0ab
  14. sergeypospelov
    closed this as completedin #890on Sep 14, 2022
  15. Repository owner moved this from In Progress to Done in UTBot Javaon Sep 14, 2022
  16. alisevych
    added
    status-verifiedBug fix is verifiedBug fix is verified
    and removed
    status-verifiedBug fix is verifiedBug fix is verified
    on Sep 15, 2022
  17. alisevych commented on Sep 15, 2022

    @alisevych
    alisevych
    on Sep 15, 2022
    MemberAuthor
    More actions

    The issue with "Unsupported class file major version" is not reproducing with JDK 13 / 17 - with same code samples.
    Code examples are processed without errors and tests are generated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @sergeypospelov
    sergeypospelov

Labels

ctg-bugIssue is a bugIssue is a bugpriority-top-focusTop priority chosen by dev teamTop priority chosen by dev teamstatus-verifiedBug fix is verifiedBug fix is verified

Type

No type

Projects

  • UTBot Java
    Status
    Done
    Show more project fields

Milestone

  • 2022.10 Release preparation

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.