mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-365198 Improve detecting of miscompiled evaluation problems
GitOrigin-RevId: 2a68d81ea4e95086a3c37724d28c6c981d194797
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f119732d95
commit
29e18c34d7
@@ -50,6 +50,13 @@ abstract class ThrownFromEvalExceptionBase(cause: Throwable) : RuntimeException(
|
||||
override fun toString(): String = "Thrown by evaluator: ${cause}"
|
||||
}
|
||||
|
||||
class Eval4JIllegalArgumentException : IllegalArgumentException {
|
||||
constructor(message: String, cause: Throwable) : super(message, cause)
|
||||
constructor(message: String) : super(message)
|
||||
}
|
||||
|
||||
class Eval4JIllegalStateException(message: String, cause: Throwable) : IllegalStateException(message, cause)
|
||||
|
||||
class BrokenCode(cause: Throwable) : ThrownFromEvalExceptionBase(cause)
|
||||
|
||||
// Interpreting exceptions should not be sent to EA
|
||||
@@ -238,7 +245,7 @@ fun interpreterLoop(
|
||||
}
|
||||
|
||||
private fun <T : Value> Frame<T>.getStackTop(i: Int = 0) = this.getStack(this.stackSize - 1 - i) ?: throwBrokenCodeException(
|
||||
IllegalArgumentException("Couldn't get value with index = $i from top of stack")
|
||||
Eval4JIllegalArgumentException("Couldn't get value with index = $i from top of stack")
|
||||
)
|
||||
|
||||
// Copied from org.jetbrains.org.objectweb.asm.tree.analysis.Analyzer.analyze()
|
||||
|
||||
@@ -228,7 +228,7 @@ open class JDIEval(
|
||||
|
||||
if (internalMethods.isNotEmpty()) {
|
||||
return internalMethods.singleOrNull()
|
||||
?: throwBrokenCodeException(IllegalArgumentException("Several internal methods found for $methodDesc"))
|
||||
?: throwBrokenCodeException(Eval4JIllegalArgumentException("Several internal methods found for $methodDesc"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -515,9 +515,9 @@ private fun <T> JdiOperationResult<T>.ifFail(lazyMessage: () -> String): T {
|
||||
is JdiOperationResult.OK -> this.value
|
||||
is JdiOperationResult.Fail -> {
|
||||
if (cause is IllegalArgumentException) {
|
||||
throwBrokenCodeException(IllegalArgumentException(lazyMessage(), this.cause))
|
||||
throwBrokenCodeException(Eval4JIllegalArgumentException(lazyMessage(), this.cause))
|
||||
} else {
|
||||
throwBrokenCodeException(IllegalStateException(lazyMessage(), this.cause))
|
||||
throwBrokenCodeException(Eval4JIllegalStateException(lazyMessage(), this.cause))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -163,6 +163,8 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, private val sourcePositi
|
||||
val cause = e.cause
|
||||
val errorType = when {
|
||||
e is ControlFlowException || e is IndexNotReadyException -> StatisticsEvaluationResult.UNRELATED_EXCEPTION
|
||||
e is LinkageError || e is Eval4JIllegalArgumentException || e is Eval4JIllegalStateException ->
|
||||
StatisticsEvaluationResult.MISCOMPILED
|
||||
e is Eval4JInterpretingException ->
|
||||
if (!hasCast && e.cause is ClassCastException) StatisticsEvaluationResult.MISCOMPILED
|
||||
else StatisticsEvaluationResult.USER_EXCEPTION
|
||||
|
||||
Reference in New Issue
Block a user