mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup [debugger]: fixed yellow code in evaluators
GitOrigin-RevId: a1b4cc1fe6a105fb4e49d13d0d6edb75684dccc5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
df082463d1
commit
5267270ad8
+8
-21
@@ -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) {
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
-10
@@ -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();
|
||||
}
|
||||
-19
@@ -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 {
|
||||
}
|
||||
+1
-1
@@ -133,7 +133,7 @@ public class MethodEvaluator implements Evaluator {
|
||||
List<Method> 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));
|
||||
|
||||
-1
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user