From 3ad65530582491c22fbc5fecdb180df09a5b05ea Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Tue, 28 Feb 2017 20:21:32 +0300 Subject: [PATCH] avoid getting all declaredMethods, it is causing Class.copyMethods for all of the methods and wasting memory (called frequently) --- .../src/com/intellij/debugger/jdi/LocalVariablesUtil.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java b/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java index 3a64816f4ac7..a36ea9c9356b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/LocalVariablesUtil.java @@ -192,7 +192,8 @@ public class LocalVariablesUtil { StackFrame frame) throws Exception { final Long frameId = ReflectionUtil.getField(frame.getClass(), frame, long.class, "id"); final VirtualMachine vm = frame.virtualMachine(); - final Method stateMethod = ReflectionUtil.getDeclaredMethod(vm.getClass(), "state"); + final Method stateMethod = vm.getClass().getDeclaredMethod("state"); + stateMethod.setAccessible(true); Object slotInfoArray = createSlotInfoArray(vars); @@ -222,7 +223,8 @@ public class LocalVariablesUtil { try { final Long frameId = ReflectionUtil.getField(frame.getClass(), frame, long.class, "id"); final VirtualMachine vm = frame.virtualMachine(); - final Method stateMethod = ReflectionUtil.getDeclaredMethod(vm.getClass(), "state"); + final Method stateMethod = vm.getClass().getDeclaredMethod("state"); + stateMethod.setAccessible(true); Object slotInfoArray = createSlotInfoArraySet(slot, value);