diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java index 283611380209..7387c7ffb0b2 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java @@ -20,6 +20,7 @@ */ package com.intellij.debugger.engine.evaluation.expression; +import com.intellij.Patches; import com.intellij.debugger.DebuggerBundle; import com.intellij.debugger.engine.DebugProcess; import com.intellij.debugger.engine.DebugProcessImpl; @@ -30,7 +31,6 @@ import com.intellij.debugger.impl.ClassLoadingUtils; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.jdi.VirtualMachineProxyImpl; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.util.SystemInfo; import com.intellij.rt.debugger.DefaultMethodInvoker; import com.sun.jdi.*; @@ -48,9 +48,6 @@ public class MethodEvaluator implements Evaluator { private final boolean myCheckDefaultInterfaceMethod; private final boolean myMustBeVararg; - // see IDEA-139945, corresponding jdk bug was fixed in 8u45 - private static boolean ourUseDefaultInvoker = !SystemInfo.isJavaVersionAtLeast("1.8.0_40"); - public MethodEvaluator(Evaluator objectEvaluator, JVMName className, String methodName, @@ -184,7 +181,7 @@ public class MethodEvaluator implements Evaluator { return debugProcess.invokeInstanceMethod(context, objRef, jdiMethod, args, ObjectReference.INVOKE_NONVIRTUAL); } // fix for default methods in interfaces, see IDEA-124066 - if (ourUseDefaultInvoker && myCheckDefaultInterfaceMethod && jdiMethod.declaringType() instanceof InterfaceType) { + if (Patches.JDK_BUG_ID_8042123 && myCheckDefaultInterfaceMethod && jdiMethod.declaringType() instanceof InterfaceType) { try { return invokeDefaultMethod(debugProcess, context, objRef, myMethodName); } catch (EvaluateException e) { diff --git a/platform/util/src/com/intellij/Patches.java b/platform/util/src/com/intellij/Patches.java index cb1c9c07347d..daea52abff4e 100644 --- a/platform/util/src/com/intellij/Patches.java +++ b/platform/util/src/com/intellij/Patches.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2014 JetBrains s.r.o. + * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -108,4 +108,10 @@ public class Patches { * fixed in JDK8 */ public static final boolean JDK_BUG_ID_7103570 = true; + + /** + * Support default methods in JDI + * See JDK-8042123 + */ + public static final boolean JDK_BUG_ID_8042123 = !SystemInfo.isJavaVersionAtLeast("1.8.0_40"); }