IDEA-181945 Unable to evaluate the expression Cannot find source class for current stack frame - log class name

This commit is contained in:
Egor Ushakov
2017-11-13 13:04:55 +03:00
parent 8795f1c979
commit bcdda88218
2 changed files with 6 additions and 17 deletions
@@ -1,20 +1,7 @@
/*
* Copyright 2000-2017 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.
*/
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.debugger.ui.tree.render;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.engine.DebuggerUtils;
import com.intellij.debugger.engine.evaluation.CodeFragmentFactory;
import com.intellij.debugger.engine.evaluation.EvaluateException;
@@ -59,10 +46,11 @@ public abstract class CachedEvaluator {
protected Cache initEvaluatorAndChildrenExpression(final Project project) {
final Cache cache = new Cache();
try {
Pair<PsiElement, PsiType> psiClassAndType = DebuggerUtilsImpl.getPsiClassAndType(getClassName(), project);
String className = getClassName();
Pair<PsiElement, PsiType> psiClassAndType = DebuggerUtilsImpl.getPsiClassAndType(className, project);
PsiElement context = psiClassAndType.first;
if (context == null) {
throw EvaluateExceptionUtil.CANNOT_FIND_SOURCE_CLASS;
throw EvaluateExceptionUtil.createEvaluateException(DebuggerBundle.message("evaluation.error.cannot.find.source", className));
}
CodeFragmentFactory factory = DebuggerUtilsEx.findAppropriateCodeFragmentFactory(myReferenceExpression, context);
JavaCodeFragment codeFragment = factory.createCodeFragment(myReferenceExpression, overrideContext(context), project);
@@ -10,6 +10,7 @@ evaluation.error.stack.frame.unavailable=Stack frame unavailable
evaluation.error.nested.evaluation=Evaluation is not supported during another method''s evaluation
evaluation.error.sources.out.of.sync=Sources do not correspond to code being executed
evaluation.error.cannot.find.stackframe.source=Cannot find source class for current stack frame
evaluation.error.cannot.find.source=Cannot find source class for {0}
evaluation.error.object.collected=Object has been collected
evaluation.error.thread.collected=Thread has been collected
evaluation.error.array.collected=Array has been collected