Skip to content

Throwable falls from overwriteUtilClass when test is regenerated #850

Closed
@alisevych

Description

@alisevych

Description

Throwable falls from overwriteUtilClass when test is regenerated

To Reproduce

  1. IntelliJ IDEA with one of the latest UTBot plugin installed
  2. Maven project with JDK 8 is opened
  3. Tests were regenerated with different settings several times: with Fuzzing only / Symbolic only / Mocks on/off

Expected behavior

No exceptions in IDEA are supposed to be thrown.

Actual behavior

Exception in plugin UnitTestBot is thrown in IDEA from overwriteUtilClass(CodeGenerationController.kt:295)

Visual proofs (screenshots, logs, images)


Details: Current thread: Thread[ApplicationImpl pooled thread 309,4,main] 135374593
Dispatch thread: false; isDispatchThread(): false
SystemEventQueueThread: Thread[AWT-EventQueue-0,6,main] 1353406047

java.lang.Throwable: Read access is allowed from inside read-action (or EDT) only (see com.intellij.openapi.application.Application.runReadAction())
	at com.intellij.openapi.diagnostic.Logger.error(Logger.java:200)
	at com.intellij.openapi.application.impl.ApplicationImpl.assertReadAccessAllowed(ApplicationImpl.java:1048)
	at com.intellij.openapi.fileEditor.impl.FileDocumentManagerBase.getDocument(FileDocumentManagerBase.java:38)
	at com.intellij.psi.impl.PsiDocumentManagerBase.getDocument(PsiDocumentManagerBase.java:168)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.overwriteUtilClass(CodeGenerationController.kt:295)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.createOrUpdateUtilClass(CodeGenerationController.kt:269)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.access$createOrUpdateUtilClass(CodeGenerationController.kt:97)
	at org.utbot.intellij.plugin.generator.CodeGenerationController$generateTests$2$1.run(CodeGenerationController.kt:160)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.waitForCountDown(CodeGenerationController.kt:473)
	at org.utbot.intellij.plugin.generator.CodeGenerationController.access$waitForCountDown(CodeGenerationController.kt:97)
	at org.utbot.intellij.plugin.generator.CodeGenerationController$waitForCountDown$1.run(CodeGenerationController.kt:471)
	at org.utbot.intellij.plugin.util.IntelliJApiHelper$run$1$1.run(IntelliJApiHelper.kt:27)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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

Windows 10 Pro
IntelliJ IDEA 2022.1.4 Ultimate
Maven project
JDK 8

Additional context

Has not reproduced with similar actions.

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions