From 235b6ca6cd8578a8a99c7f4dc51c0af1f9f69f64 Mon Sep 17 00:00:00 2001 From: Andrey Uskov Date: Thu, 6 Dec 2018 20:23:05 +0300 Subject: [PATCH] Fix stacktrace check for KT-27718. This work-around should be removed after fix of IDEA-203651 #KT-27718 Fixed --- .../src/org/jetbrains/kotlin/config/KotlinRootType.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt index 0f236b66e20..689ac3c0748 100644 --- a/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt +++ b/idea/idea-jps-common/src/org/jetbrains/kotlin/config/KotlinRootType.kt @@ -11,8 +11,9 @@ interface KotlinRootType { fun isSameRootType(kotlinRoot: KotlinRootType, other: Any?): Boolean { if (kotlinRoot.isTestRoot()) { if (other is JavaResourceRootType || other is JavaSourceRootType) { + val invokeLevel = 3 val stack = Thread.currentThread().stackTrace - if (stack.size > 2 && "isTestSource" == stack[2].methodName && "com.intellij.openapi.roots.impl.SourceFolderImpl" == stack[2].className) { + if (stack.size > invokeLevel && "isTestSource" == stack[invokeLevel].methodName && "com.intellij.openapi.roots.impl.SourceFolderImpl" == stack[invokeLevel].className) { if (JavaResourceRootType.TEST_RESOURCE == other) { return true }