mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
EA-66497 - OCE: ExpressionChildrenRenderer.getChildrenRenderer
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
package com.intellij.debugger.impl;
|
||||
|
||||
import com.intellij.debugger.engine.DebugProcess;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
@@ -44,7 +43,7 @@ public class ClassLoadingUtils {
|
||||
Method ctorMethod = loaderClass.concreteMethodByName("<init>", "([Ljava/net/URL;Ljava/lang/ClassLoader;)V");
|
||||
ClassLoaderReference reference = (ClassLoaderReference)process.newInstance(context, loaderClass, ctorMethod, Arrays
|
||||
.asList(createURLArray(context), context.getClassLoader()));
|
||||
keep(reference, context);
|
||||
DebuggerUtilsEx.keep(reference, context);
|
||||
return reference;
|
||||
}
|
||||
catch (Exception e) {
|
||||
@@ -62,7 +61,7 @@ public class ClassLoadingUtils {
|
||||
Method defineMethod =
|
||||
((ClassType)classLoader.referenceType()).concreteMethodByName("defineClass", "(Ljava/lang/String;[BII)Ljava/lang/Class;");
|
||||
StringReference nameObj = proxy.mirrorOf(name);
|
||||
keep(nameObj, context);
|
||||
DebuggerUtilsEx.keep(nameObj, context);
|
||||
process.invokeMethod(context, classLoader, defineMethod,
|
||||
Arrays.asList(nameObj,
|
||||
mirrorOf(bytes, context, process),
|
||||
@@ -119,14 +118,14 @@ public class ClassLoadingUtils {
|
||||
DebugProcess process = context.getDebugProcess();
|
||||
ArrayType arrayType = (ArrayType)process.findClass(context, "java.net.URL[]", context.getClassLoader());
|
||||
ArrayReference arrayRef = arrayType.newInstance(1);
|
||||
keep(arrayRef, context);
|
||||
DebuggerUtilsEx.keep(arrayRef, context);
|
||||
ClassType classType = (ClassType)process.findClass(context, "java.net.URL", context.getClassLoader());
|
||||
VirtualMachineProxyImpl proxy = (VirtualMachineProxyImpl)process.getVirtualMachineProxy();
|
||||
StringReference url = proxy.mirrorOf("file:a");
|
||||
keep(url, context);
|
||||
DebuggerUtilsEx.keep(url, context);
|
||||
ObjectReference reference = process.newInstance(context, classType, classType.concreteMethodByName("<init>", "(Ljava/lang/String;)V"),
|
||||
Collections.singletonList(url));
|
||||
keep(reference, context);
|
||||
DebuggerUtilsEx.keep(reference, context);
|
||||
arrayRef.setValues(Collections.singletonList(reference));
|
||||
return arrayRef;
|
||||
}
|
||||
@@ -135,14 +134,10 @@ public class ClassLoadingUtils {
|
||||
throws EvaluateException, InvalidTypeException, ClassNotLoadedException {
|
||||
ArrayType arrayClass = (ArrayType)process.findClass(context, "byte[]", context.getClassLoader());
|
||||
ArrayReference reference = process.newInstance(arrayClass, bytes.length);
|
||||
keep(reference, context);
|
||||
DebuggerUtilsEx.keep(reference, context);
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
reference.setValue(i, ((VirtualMachineProxyImpl)process.getVirtualMachineProxy()).mirrorOf(bytes[i]));
|
||||
}
|
||||
return reference;
|
||||
}
|
||||
|
||||
public static void keep(ObjectReference reference, EvaluationContext context) {
|
||||
((SuspendContextImpl)context.getSuspendContext()).keep(reference);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -446,6 +446,12 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void keep(Value value, EvaluationContext context) {
|
||||
if (value instanceof ObjectReference) {
|
||||
((SuspendContextImpl)context.getSuspendContext()).keep((ObjectReference)value);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract DebuggerTreeNode getSelectedNode (DataContext context);
|
||||
|
||||
public abstract EvaluatorBuilder getEvaluatorBuilder();
|
||||
|
||||
+5
-12
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -25,13 +25,12 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.expression.UnsupportedExpressionException;
|
||||
import com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator;
|
||||
import com.intellij.debugger.engine.evaluation.expression.Modifier;
|
||||
import com.intellij.debugger.engine.evaluation.expression.UnsupportedExpressionException;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.impl.PositionUtil;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.psi.*;
|
||||
@@ -39,7 +38,6 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.refactoring.extractMethod.PrepareFailedException;
|
||||
import com.intellij.refactoring.extractMethodObject.ExtractLightMethodObjectHandler;
|
||||
import com.sun.jdi.ObjectCollectedException;
|
||||
import com.sun.jdi.ObjectReference;
|
||||
import com.sun.jdi.Value;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -124,14 +122,9 @@ public abstract class EvaluationDescriptor extends ValueDescriptorImpl{
|
||||
throw EvaluateExceptionUtil.NULL_STACK_FRAME;
|
||||
}
|
||||
|
||||
final Value value = evaluator.evaluate(thisEvaluationContext);
|
||||
if (value instanceof ObjectReference) {
|
||||
ObjectReference objRef = (ObjectReference)value;
|
||||
if (VirtualMachineProxyImpl.isCollected(objRef)) {
|
||||
throw EvaluateExceptionUtil.OBJECT_WAS_COLLECTED;
|
||||
}
|
||||
thisEvaluationContext.getSuspendContext().keep(objRef);
|
||||
}
|
||||
Value value = evaluator.evaluate(thisEvaluationContext);
|
||||
DebuggerUtilsEx.keep(value, thisEvaluationContext);
|
||||
|
||||
myModifier = evaluator.getModifier();
|
||||
setLvalue(myModifier != null);
|
||||
|
||||
|
||||
+4
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -24,6 +24,7 @@ import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.evaluation.TextWithImports;
|
||||
import com.intellij.debugger.engine.evaluation.expression.ExpressionEvaluator;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.ui.tree.DebuggerTreeNode;
|
||||
import com.intellij.debugger.ui.tree.NodeDescriptor;
|
||||
import com.intellij.debugger.ui.tree.NodeManager;
|
||||
@@ -104,6 +105,8 @@ public class ExpressionChildrenRenderer extends ReferenceRenderer implements Chi
|
||||
final ExpressionEvaluator evaluator = myChildrenExpression.getEvaluator(context.getProject());
|
||||
|
||||
Value value = evaluator.evaluate(context);
|
||||
DebuggerUtilsEx.keep(value, context);
|
||||
|
||||
descriptor.putUserData(EXPRESSION_VALUE, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user