Skip to content

IndexNotReadyException thrown in IDEA with installed UnitTestBot plug… #586

New issue

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

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

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,8 @@ object CodeGenerationController {

val classUnderTest = testSets.first().method.clazz

val params = findMethodParams(classUnderTest, selectedMethods)
val params = DumbService.getInstance(model.project)
.runReadActionInSmartMode(Computable { findMethodParams(classUnderTest, selectedMethods) })

val codeGenerator = CodeGenerator(
classUnderTest = classUnderTest.java,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.module.Module
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.Task
import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.OrderEnumerator
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.util.Computable
import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiClass
import com.intellij.psi.SyntheticElement
Expand Down Expand Up @@ -150,7 +152,9 @@ object UtTestsDialogProcessor {
.filterWhen(UtSettings.skipTestGenerationForSyntheticMethods) {
it.member !is SyntheticElement
}
findMethodsInClassMatchingSelected(clazz, srcMethods)
DumbService.getInstance(project).runReadActionInSmartMode(Computable {
findMethodsInClassMatchingSelected(clazz, srcMethods)
})
}.executeSynchronously()

val className = srcClass.name
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
package org.utbot.intellij.plugin.util

import com.intellij.openapi.project.DumbService
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Computable
import com.intellij.psi.PsiMethod
import com.intellij.refactoring.util.classMembers.MemberInfo
import kotlin.reflect.KFunction
import kotlin.reflect.KParameter
import kotlin.reflect.jvm.javaType

fun MemberInfo.signature(): Signature =
(this.member as PsiMethod).signature()
(this.member as PsiMethod).signature()

fun PsiMethod.signature() =
private fun PsiMethod.signature() =
Signature(this.name, this.parameterList.parameters.map {
it.type.canonicalText
.replace("...", "[]") //for PsiEllipsisType
Expand Down