Skip to content
Open
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 @@ -76,12 +76,12 @@ object MethodInvokeUtils {
}

fun getMethodHandlesImplLookup(evaluationContext: EvaluationContextImpl): ObjectReference? {
val theClass = evaluationContext.debugProcess.findClass(evaluationContext,
"java.lang.invoke.MethodHandles\$Lookup",
null)
val theField = DebuggerUtils.findField(theClass,
"IMPL_LOOKUP")
return theClass?.getValue(theField) as? ObjectReference
val theClass = runCatching {
// On Android API < 26, this will throw
evaluationContext.debugProcess.findClass(evaluationContext, "java.lang.invoke.MethodHandles\$Lookup", null)
}.getOrNull() ?: return null
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runCatching silently swallows cancellation exceptions

Medium Severity

Using runCatching here catches all Throwable instances, including ProcessCanceledException and CancellationException, which are used by the IntelliJ Platform for task cancellation. Swallowing these causes the method to return null instead of propagating the cancellation signal, potentially leaving the IDE in an unresponsive or inconsistent state when the user cancels an evaluation. A try/catch that rethrows cancellation exceptions would be appropriate here.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1c2b159. Configure here.

val theField = DebuggerUtils.findField(theClass, "IMPL_LOOKUP")
return theClass.getValue(theField) as? ObjectReference
}
}

Expand Down