diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java index e30f9377cb52..3f7206e05352 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/CodeFragmentEvaluator.java @@ -11,7 +11,6 @@ import com.intellij.debugger.jdi.VirtualMachineProxyImpl; import com.intellij.openapi.diagnostic.Logger; import com.sun.jdi.Value; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.HashMap; import java.util.Map; @@ -32,22 +31,9 @@ public class CodeFragmentEvaluator extends BlockStatementEvaluator { } public Value getValue(@NotNull String localName, @NotNull EvaluationContextImpl context) throws EvaluateException { - return getValue(localName, context.getSuspendContext().getVirtualMachineProxy(), context); - } - - /** - * @deprecated Use {@link #getValue(String, EvaluationContextImpl)} instead - */ - @Deprecated - public Value getValue(@NotNull String localName, @NotNull VirtualMachineProxyImpl vm) throws EvaluateException { - return getValue(localName, vm, null); - } - - private Value getValue(@NotNull String localName, @NotNull VirtualMachineProxyImpl vm, @Nullable EvaluationContextImpl context) - throws EvaluateException { if (!mySyntheticLocals.containsKey(localName)) { if (myParentFragmentEvaluator != null) { - return myParentFragmentEvaluator.getValue(localName, vm); + return myParentFragmentEvaluator.getValue(localName, context); } else { throw EvaluateExceptionUtil.createEvaluateException(JavaDebuggerBundle.message("evaluation.error.variable.not.declared", localName)); @@ -60,7 +46,9 @@ public class CodeFragmentEvaluator extends BlockStatementEvaluator { else if (value == null) { return null; } - else if (value instanceof Boolean) { + + @NotNull VirtualMachineProxyImpl vm = context.getSuspendContext().getVirtualMachineProxy(); + if (value instanceof Boolean) { return vm.mirrorOf(((Boolean)value).booleanValue()); } else if (value instanceof Byte) { @@ -85,12 +73,11 @@ public class CodeFragmentEvaluator extends BlockStatementEvaluator { return vm.mirrorOf(((Double)value).doubleValue()); } else if (value instanceof String stringValue) { - return context != null ? DebuggerUtilsEx.mirrorOfString(stringValue, context) : vm.getVirtualMachine().mirrorOf(stringValue); - } - else { - LOG.error("unknown default initializer type " + value.getClass().getName()); - return null; + return DebuggerUtilsEx.mirrorOfString(stringValue, context); } + + LOG.error("unknown default initializer type " + value.getClass().getName()); + return null; } boolean hasValue(String localName) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/DisableGC.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/DisableGC.java index 13afa391999d..78acfe902f9f 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/DisableGC.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/DisableGC.java @@ -24,7 +24,7 @@ public final class DisableGC implements ModifiableEvaluator { } @Override - public @NotNull ModifiableValue evaluateModifiable(EvaluationContextImpl context) throws EvaluateException { + public @NotNull ModifiableValue evaluateModifiable(@NotNull EvaluationContextImpl context) throws EvaluateException { if (myDelegate instanceof ModifiableEvaluator modifiableEvaluator) { ModifiableValue result = modifiableEvaluator.evaluateModifiable(context); Object value = result.getValue(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/InspectArrayItem.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/InspectArrayItem.java deleted file mode 100644 index 28b617640953..000000000000 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/InspectArrayItem.java +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package com.intellij.debugger.engine.evaluation.expression; - -import com.sun.jdi.ArrayReference; - -public interface InspectArrayItem extends InspectEntity { - ArrayReference getArray(); - - int getItemIndex(); -} diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/InspectEntity.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/InspectEntity.java deleted file mode 100644 index 1e31213e1756..000000000000 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/InspectEntity.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2000-2009 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.debugger.engine.evaluation.expression; - -public interface InspectEntity { -} 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 6e0a1442cd02..43a538864ffd 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 @@ -133,7 +133,7 @@ public class MethodEvaluator implements Evaluator { List matchingMethods = StreamEx.of(referenceType.methodsByName(myMethodName)).filter(m -> m.argumentTypeNames().size() == args.size()).toList(); if (matchingMethods.size() == 1) { - jdiMethod = matchingMethods.get(0); + jdiMethod = matchingMethods.getFirst(); } else if (matchingMethods.size() > 1) { jdiMethod = ContainerUtil.find(matchingMethods, m -> matchArgs(m, args)); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java index d7b7194c81d9..30b84eb89e00 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/NewArrayInstanceEvaluator.java @@ -41,7 +41,6 @@ class NewArrayInstanceEvaluator implements Evaluator { @Override public Object evaluate(EvaluationContextImpl context) throws EvaluateException { // throw new EvaluateException("Creating new array instances is not supported yet", true); - DebugProcessImpl debugProcess = context.getDebugProcess(); Object obj = myArrayTypeEvaluator.evaluate(context); if (!(obj instanceof ArrayType arrayType)) { throw EvaluateExceptionUtil.createEvaluateException(JavaDebuggerBundle.message("evaluation.error.array.type.expected"));