From f474714d331820808502a799a8d864da4a98e979 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Wed, 9 Nov 2016 19:31:56 +0300 Subject: [PATCH] IDEA-163730 Incorrect value of logic operation stringVar == "value" --- .../evaluation/expression/LiteralEvaluator.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LiteralEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LiteralEvaluator.java index 1d949dd7bbca..e1393341c323 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LiteralEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/LiteralEvaluator.java @@ -26,6 +26,11 @@ import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil; import com.intellij.debugger.engine.evaluation.EvaluationContextImpl; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.jdi.VirtualMachineProxyImpl; +import com.intellij.util.containers.ContainerUtil; +import com.sun.jdi.Method; +import com.sun.jdi.StringReference; + +import java.util.Collections; class LiteralEvaluator implements Evaluator { private final Object myValue; @@ -57,7 +62,13 @@ class LiteralEvaluator implements Evaluator { return DebuggerUtilsEx.createValue(vm, myExpectedType, ((Number)myValue).longValue()); } if (myValue instanceof String) { - return vm.mirrorOf((String)myValue); + StringReference str = vm.mirrorOf((String)myValue); + // intern + Method internMethod = ContainerUtil.getFirstItem(str.referenceType().methodsByName("intern", "()Ljava/lang/String;")); + if (internMethod != null) { + return context.getDebugProcess().invokeMethod(context, str, internMethod, Collections.emptyList()); + } + return str; } throw EvaluateExceptionUtil .createEvaluateException(DebuggerBundle.message("evaluation.error.unknown.expression.type", myExpectedType));