mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[debugger] prevent the exception garbage collection in helper
GitOrigin-RevId: b85234a5a0d83ef25e04655abb65fb70664dcab9
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a7a97cceb8
commit
700b9b8e6b
@@ -9,7 +9,7 @@ import java.lang.invoke.WrongMethodTypeException;
|
||||
@SuppressWarnings({"SSBasedInspection", "unused"})
|
||||
public final class MethodInvoker {
|
||||
// TODO: may leak objects here
|
||||
static ThreadLocal<Object> returnValue = new ThreadLocal<>();
|
||||
static ThreadLocal<Object> keptValue = new ThreadLocal<>();
|
||||
|
||||
public static Object invoke0(MethodHandles.Lookup lookup, Class<?> cls, Object obj, String nameAndDescriptor, ClassLoader loader)
|
||||
throws Throwable {
|
||||
@@ -207,11 +207,16 @@ public final class MethodInvoker {
|
||||
}
|
||||
|
||||
Object result = method.invokeWithArguments(args);
|
||||
returnValue.set(result);
|
||||
keptValue.set(result);
|
||||
return result;
|
||||
}
|
||||
catch (WrongMethodTypeException | ClassCastException e) {
|
||||
e.printStackTrace();
|
||||
keptValue.set(e);
|
||||
throw e;
|
||||
}
|
||||
catch (Throwable e) {
|
||||
keptValue.set(e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user