Description
Launching UTBot on methods from Kotlin code repeatedly gives the same exception.
To Reproduce
Create any file in Kotlin and launch plugin on A.f() from the example below:
public class A {
fun f(): Int {
return 2
}
}
fun main(args: Array<String>) {}
Expected behavior
Tests are generated with no exceptions.
Actual behavior
Tests are generated correctly, but java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action only is produced.
Visual proofs (screenshots, logs, images)
Details: Current thread: Thread[ApplicationImpl pooled thread 11,4,Idea Thread Group] 354081768
; dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,Idea Thread Group] 558590277
java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:161)
at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1013)
at com.intellij.psi.impl.source.PsiFileImpl.assertReadAccessAllowed(PsiFileImpl.java:183)
at com.intellij.psi.impl.source.PsiFileImpl.getStubTree(PsiFileImpl.java:615)
at com.intellij.psi.impl.source.SpineRef.getStub(SpineRef.java:32)
at com.intellij.extapi.psi.StubBasedPsiElementBase.getStub(StubBasedPsiElementBase.java:363)
at org.jetbrains.kotlin.psi.KtNamedDeclarationStub.getName(KtNamedDeclarationStub.java:56)
at org.jetbrains.kotlin.psi.KtTypeParameterListOwnerStub.getName(KtTypeParameterListOwnerStub.java:29)
at org.jetbrains.kotlin.psi.KtNamedDeclarationStub.getNameAsName(KtNamedDeclarationStub.java:73)
at org.jetbrains.kotlin.psi.KtTypeParameterListOwnerStub.getNameAsName(KtTypeParameterListOwnerStub.java:29)
at org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration.getName(KtLightClassForSourceDeclaration.kt:198)
at org.utbot.intellij.plugin.generator.UtTestsDialogProcessor$createTests$2$1.run(UtTestsDialogProcessor.kt:167)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:935)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:442)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:652)
at java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:649)
at java.security.AccessController.doPrivileged(Native Method)
at java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:649)
at java.lang.Thread.run(Thread.java:750)
Environment
Java 1.8, JUnit5, Mockito, Mockito static mocking, Not parametrized
Additional context
The only link to our code in stacktrace seems to be UtTestsDialogProcessor.kt:167 (val className = srcClass.name)
Description
Launching UTBot on methods from Kotlin code repeatedly gives the same exception.
To Reproduce
Create any file in Kotlin and launch plugin on
A.f()from the example below:Expected behavior
Tests are generated with no exceptions.
Actual behavior
Tests are generated correctly, but
java.lang.Throwable: Read access is allowed from event dispatch thread or inside read-action onlyis produced.Visual proofs (screenshots, logs, images)
Environment
Java 1.8, JUnit5, Mockito, Mockito static mocking, Not parametrized
Additional context
The only link to our code in stacktrace seems to be
UtTestsDialogProcessor.kt:167(val className = srcClass.name)