use the correct Patches const

This commit is contained in:
Egor.Ushakov
2016-11-02 15:18:19 +03:00
parent 9e528d889d
commit 9d2809a210
2 changed files with 19 additions and 19 deletions
@@ -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);