IDEA-172425 Add a new registry to manage compiling evaluator behavior
authorVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Tue, 13 Mar 2018 12:41:37 +0000 (15:41 +0300)
committerVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Tue, 13 Mar 2018 12:41:37 +0000 (15:41 +0300)
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java
java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluatorImpl.java
java/java-impl/src/com/intellij/refactoring/extractMethodObject/ExtractLightMethodObjectHandler.java
platform/util/resources/misc/registry.properties

index cbb9d12dc1634799e8459b2d672102132390cd34..1c57767665e8ecf4251493d99bfeee0b63b15a4a 100644 (file)
@@ -16,6 +16,7 @@ import com.intellij.openapi.application.ReadAction;
 import com.intellij.openapi.compiler.ClassObject;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.projectRoots.JavaSdkVersion;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.psi.PsiElement;
 import com.intellij.refactoring.extractMethodObject.ExtractLightMethodObjectHandler;
 import com.sun.jdi.ClassLoaderReference;
@@ -91,7 +92,8 @@ public abstract class CompilingEvaluator implements ExpressionEvaluator {
                              EvaluationContext context,
                              DebugProcess process,
                              ClassLoaderReference classLoader) throws EvaluateException {
-    boolean useMagicAccessorImpl = version != null && !version.isAtLeast(JavaSdkVersion.JDK_1_9);
+    boolean useMagicAccessorImpl = version != null && !version.isAtLeast(JavaSdkVersion.JDK_1_9) &&
+                                   Registry.is("debugger.compiling.evaluator.magic.accessor");
 
     for (ClassObject cls : classes) {
       if (cls.getPath().contains(GEN_CLASS_NAME)) {
index 6096aed7f6aa2efbd088067eb55efe76e38d755e..8bfdc849f2248e0ed57936af5d620e35564095af 100644 (file)
@@ -144,7 +144,7 @@ public class CompilingEvaluatorImpl extends CompilingEvaluator {
     if (Registry.is("debugger.compiling.evaluator") && psiContext != null) {
       return ApplicationManager.getApplication().runReadAction((ThrowableComputable<ExpressionEvaluator, EvaluateException>)() -> {
         try {
-          boolean useReflection = !Registry.is("debugger.compiling.evaluator.magic.accessor", true);
+          boolean useReflection = Registry.is("debugger.compiling.evaluator.reflection.access.with.java8");
           XDebugSession currentSession = XDebuggerManager.getInstance(project).getCurrentSession();
           if (!useReflection && currentSession != null) {
             XSuspendContext suspendContext = currentSession.getSuspendContext();
index 1ba69a12ea7e4619c56152ce1654225c8489a012..ee04860d3900aed7a9dd2cb034fac2b45c89b0d7 100644 (file)
@@ -19,6 +19,7 @@ import com.intellij.codeInsight.CodeInsightUtil;
 import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.TextRange;
+import com.intellij.openapi.util.registry.Registry;
 import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.psi.*;
 import com.intellij.psi.codeStyle.CodeStyleManager;
@@ -198,7 +199,7 @@ public class ExtractLightMethodObjectHandler {
     PsiStatement outStatement = elementFactory.createStatementFromText("System.out.println(" + outputVariables + ");", anchor);
     outStatement = (PsiStatement)container.addAfter(outStatement, elementsCopy[elementsCopy.length - 1]);
 
-    if (!useReflection) {
+    if (Registry.is("debugger.compiling.evaluator.magic.accessor") && !useReflection) {
       copy.accept(new JavaRecursiveElementWalkingVisitor() {
         private void makePublic(PsiMember method) {
           if (method.hasModifierProperty(PsiModifier.PRIVATE)) {
index b7a00a0308bb58f8421702d4cc417b3f2e5df0da..8638ab34751ea17980774618ba227234ca0674ff 100644 (file)
@@ -361,6 +361,7 @@ debugger.mayBringFrameToFrontOnBreakpoint=true
 debugger.batch.evaluation=false
 debugger.compiling.evaluator=true
 debugger.compiling.evaluator.magic.accessor=false
+debugger.compiling.evaluator.reflection.access.with.java8=true
 debugger.watches.in.variables=true
 debugger.auto.fetch.icons=true
 debugger.close.dialog.on.navigate=true