From 9d2809a2108e6cbe2b9e8c6a62c48e26cbb73a8c Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 2 Nov 2016 15:11:31 +0300 Subject: [PATCH] use the correct Patches const --- .../debugger/engine/DebugProcessImpl.java | 36 +++++++++---------- platform/util/src/com/intellij/Patches.java | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index e48ac9afb834..61743bb2bd2b 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -1199,11 +1199,6 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb }.start((EvaluationContextImpl)evaluationContext, internalEvaluate); } - static { - //noinspection ConstantConditions - assert Patches.USE_REFLECTION_TO_ACCESS_JDK8; - } - public Value invokeMethod(EvaluationContext evaluationContext, InterfaceType interfaceType, Method method, @@ -1218,20 +1213,25 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb if (LOG.isDebugEnabled()) { LOG.debug("Invoking " + interfaceType.name() + "." + method.name()); } - //TODO: remove reflection after move to java 8 or 9, this API was introduced in 1.8.0_45 - java.lang.reflect.Method invokeMethod = - ReflectionUtil.getMethod(InterfaceType.class, "invokeMethod", ThreadReference.class, Method.class, List.class, int.class); - if (invokeMethod == null) { - throw new IllegalStateException("Interface method invocation is not supported in JVM " + - SystemInfo.JAVA_VERSION + - ". Use JVM 1.8.0_45 or higher to run " + - ApplicationNamesInfo.getInstance().getFullProductName()); + if (Patches.JDK_BUG_ID_8042123) { + //TODO: remove reflection after move to java 8 or 9, this API was introduced in 1.8.0_45 + java.lang.reflect.Method invokeMethod = + ReflectionUtil.getMethod(InterfaceType.class, "invokeMethod", ThreadReference.class, Method.class, List.class, int.class); + if (invokeMethod == null) { + throw new IllegalStateException("Interface method invocation is not supported in JVM " + + SystemInfo.JAVA_VERSION + + ". Use JVM 1.8.0_45 or higher to run " + + ApplicationNamesInfo.getInstance().getFullProductName()); + } + try { + return (Value)invokeMethod.invoke(interfaceType, thread, method, args, invokePolicy); + } + catch (Exception e) { + throw new RuntimeException(e); + } } - try { - return (Value)invokeMethod.invoke(interfaceType, thread, method, args, invokePolicy); - } - catch (Exception e) { - throw new RuntimeException(e); + else { + return interfaceType.invokeMethod(thread, method, args, invokePolicy); } } }.start((EvaluationContextImpl)evaluationContext, false); diff --git a/platform/util/src/com/intellij/Patches.java b/platform/util/src/com/intellij/Patches.java index 2291c736d6d1..f9e2f0ebc421 100644 --- a/platform/util/src/com/intellij/Patches.java +++ b/platform/util/src/com/intellij/Patches.java @@ -75,7 +75,7 @@ public class Patches { * Support default methods in JDI * See JDK-8042123 */ - public static final boolean JDK_BUG_ID_8042123 = !SystemInfo.isJavaVersionAtLeast("1.8.0_40"); + public static final boolean JDK_BUG_ID_8042123 = !SystemInfo.isJavaVersionAtLeast("1.8.0_45"); /** * Enable workaround for jdk bug with leaking TargetVM.EventController, see IDEA-163334