Skip to content

ClassLoader throws UnsupportedClassVersionError on test generation with Gradle project and JDK 13 #349

New issue

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

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

Already on GitHub? # to your account

Closed
alisevych opened this issue Jun 29, 2022 · 2 comments
Assignees
Labels
ctg-bug Issue is a bug priority-top-focus Top priority chosen by dev team spec-release-tailings Failed to include in the current release, let's include it in the next one status-verified Bug fix is verified

Comments

@alisevych
Copy link
Member

alisevych commented Jun 29, 2022

Description

ClassLoader throws UnsupportedClassVersionError on test generation with Gradle project and JDK 13.
New runs of test generation for the same class - new errors are not shown, but tests are not generated.
New exception is thrown for the new class .

To Reproduce

Steps to reproduce the behavior:

  1. Open IntelliJ IDEA
  2. Reinstall new version of plugin
  3. Create a new Gradle project with JDK 13
  4. Add a simple class
  5. Generate tests with UTBot... with default settings

Expected behavior

Tests are supposed to be generated.

Actual behavior

An error is shown in IDE with the following stacktrace:

java.lang.UnsupportedClassVersionError: org/example/A has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at org.utbot.intellij.plugin.ui.UtTestsDialogProcessor$createTests$2$1$run$methods$1.call(UtTestsDialogProcessor.kt:125)
	at org.utbot.intellij.plugin.ui.UtTestsDialogProcessor$createTests$2$1$run$methods$1.call(UtTestsDialogProcessor.kt:96)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.insideReadAction(NonBlockingReadActionImpl.java:536)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.lambda$attemptComputation$3(NonBlockingReadActionImpl.java:501)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1152)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:75)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runActionAndCancelBeforeWrite(ProgressIndicatorUtils.java:158)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:115)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:58)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)
	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:176)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:58)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:112)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:75)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.attemptComputation(NonBlockingReadActionImpl.java:501)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl$Submission.executeSynchronously(NonBlockingReadActionImpl.java:428)
	at com.intellij.openapi.application.impl.NonBlockingReadActionImpl.executeSynchronously(NonBlockingReadActionImpl.java:186)
	at org.utbot.intellij.plugin.ui.UtTestsDialogProcessor$createTests$2$1.run(UtTestsDialogProcessor.kt:129)
	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:244)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:189)
	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:176)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:244)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
	at java.base/java.lang.Thread.run(Thread.java:829)

Environment

IntelliJ IDEA 2022.1.3 (Ultimate Edition)
Build #IU-221.5921.22, built on June 21, 2022

Runtime version: 11.0.15+10-b2043.56 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8
Non-Bundled Plugins:
org.jetbrains.kotlin (221-1.7.0-release-281-IJ5591.52)
org.utbot.intellij.plugin.id (2022.6-beta)

Additional context

Adding the following lines to build.gradle fixes this conflict:

sourceCompatibility = 11
targetCompatibility = 11
@alisevych alisevych added ctg-bug Issue is a bug priority-top-focus Top priority chosen by dev team labels Jun 29, 2022
@alisevych
Copy link
Member Author

Same exception is thrown in IDEA project with JDK 13.
So here are both stacktraces:
IDEA stacktrace.txt
Gradle stacktrace.txt

lehvolk added a commit that referenced this issue Jul 1, 2022
lehvolk added a commit that referenced this issue Jul 27, 2022
lehvolk added a commit that referenced this issue Jul 27, 2022
lehvolk added a commit that referenced this issue Jul 28, 2022
lehvolk added a commit that referenced this issue Jul 28, 2022
lehvolk added a commit that referenced this issue Jul 29, 2022
lehvolk added a commit that referenced this issue Aug 1, 2022
lehvolk added a commit that referenced this issue Aug 2, 2022
lehvolk added a commit that referenced this issue Aug 4, 2022
- some tests are green

#349
@lehvolk lehvolk mentioned this issue Aug 4, 2022
7 tasks
lehvolk added a commit that referenced this issue Aug 5, 2022
- introduce scope for calling reflection api

#349
lehvolk added a commit that referenced this issue Aug 5, 2022
- fix some tests

#349
lehvolk added a commit that referenced this issue Aug 23, 2022
lehvolk added a commit that referenced this issue Aug 23, 2022
lehvolk added a commit that referenced this issue Aug 23, 2022
…Bot and switching to usage of this structures in JCDB

#349
@alisevych alisevych added this to the Release preparation milestone Sep 7, 2022
@lehvolk lehvolk removed their assignment Sep 9, 2022
@JaneEugenia JaneEugenia moved this to In Progress in UTBot Java Sep 9, 2022
@alisevych alisevych removed this from the Release preparation milestone Sep 28, 2022
@alisevych alisevych added the spec-release-tailings Failed to include in the current release, let's include it in the next one label Sep 29, 2022
@sergeypospelov sergeypospelov moved this from In Progress to Todo in UTBot Java Oct 3, 2022
@alisevych alisevych added this to the 2022.12 Release milestone Oct 7, 2022
@sergeypospelov sergeypospelov moved this from Todo to Done in UTBot Java Oct 19, 2022
@sergeypospelov
Copy link
Member

This issue should be already fixed by #1067.

@alisevych alisevych added the status-verified Bug fix is verified label Oct 19, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
ctg-bug Issue is a bug priority-top-focus Top priority chosen by dev team spec-release-tailings Failed to include in the current release, let's include it in the next one status-verified Bug fix is verified
Projects
Archived in project
Development

No branches or pull requests

3 participants