mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-164680 Exception when creating Class Level Watch with stream().filter()
This commit is contained in:
@@ -79,12 +79,16 @@ public abstract class CompilingEvaluator implements ExpressionEvaluator {
|
||||
public Value evaluate(final EvaluationContext evaluationContext) throws EvaluateException {
|
||||
DebugProcess process = evaluationContext.getDebugProcess();
|
||||
|
||||
ClassLoaderReference classLoader = ClassLoadingUtils.getClassLoader(evaluationContext, process);
|
||||
EvaluationContextImpl autoLoadContext = ((EvaluationContextImpl)evaluationContext).createEvaluationContext(evaluationContext.getThisObject());
|
||||
autoLoadContext.setAutoLoadClasses(true);
|
||||
|
||||
ClassLoaderReference classLoader = ClassLoadingUtils.getClassLoader(autoLoadContext, process);
|
||||
autoLoadContext.setClassLoader(classLoader);
|
||||
|
||||
String version = ((VirtualMachineProxyImpl)process.getVirtualMachineProxy()).version();
|
||||
Collection<ClassObject> classes = compile(JdkVersionUtil.getVersion(version));
|
||||
|
||||
defineClasses(classes, evaluationContext, process, classLoader);
|
||||
defineClasses(classes, autoLoadContext, process, classLoader);
|
||||
|
||||
try {
|
||||
// invoke base evaluator on call code
|
||||
@@ -99,8 +103,7 @@ public abstract class CompilingEvaluator implements ExpressionEvaluator {
|
||||
return factory.getEvaluatorBuilder().build(factory.createCodeFragment(callCode, copyContext, myProject), position);
|
||||
}
|
||||
});
|
||||
((EvaluationContextImpl)evaluationContext).setClassLoader(classLoader);
|
||||
return evaluator.evaluate(evaluationContext);
|
||||
return evaluator.evaluate(autoLoadContext);
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new EvaluateException("Error during generated code invocation " + e, e);
|
||||
|
||||
+3
-4
@@ -74,13 +74,12 @@ public abstract class EvaluationDescriptor extends ValueDescriptorImpl {
|
||||
PsiElement psiContext = ContextUtil.getContextElement(evaluationContext, position);
|
||||
|
||||
ExpressionEvaluator evaluator = DebuggerInvocationUtil.commitAndRunReadAction(myProject, () -> {
|
||||
PsiCodeFragment code = getEvaluationCode(thisEvaluationContext);
|
||||
try {
|
||||
return DebuggerUtilsEx.findAppropriateCodeFragmentFactory(getEvaluationText(), psiContext)
|
||||
.getEvaluatorBuilder()
|
||||
.build(getEvaluationCode(thisEvaluationContext), position);
|
||||
return DebuggerUtilsEx.findAppropriateCodeFragmentFactory(getEvaluationText(), psiContext).getEvaluatorBuilder().build(code, position);
|
||||
}
|
||||
catch (UnsupportedExpressionException ex) {
|
||||
ExpressionEvaluator eval = CompilingEvaluatorImpl.create(myProject, psiContext, this::createCodeFragment);
|
||||
ExpressionEvaluator eval = CompilingEvaluatorImpl.create(myProject, code.getContext(), element -> code);
|
||||
if (eval != null) {
|
||||
return eval;
|
||||
}
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ public class ExtractLightMethodObjectHandler {
|
||||
}
|
||||
}
|
||||
|
||||
final PsiClass containingClass = PsiTreeUtil.getParentOfType(originalAnchor, PsiClass.class);
|
||||
final PsiClass containingClass = PsiTreeUtil.getParentOfType(originalAnchor, PsiClass.class, false);
|
||||
if (containingClass == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user