IDEA-172425 Add a new registry to manage compiling evaluator behavior

This commit is contained in:
Vitaliy.Bibaev
2018-03-13 15:41:37 +03:00
parent 766a1aa26d
commit 63e13170ef
4 changed files with 7 additions and 3 deletions
@@ -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)) {
@@ -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();
@@ -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)) {
@@ -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