From 148474ce10c23842c6c5000b1735cd83788e1272 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 11 Sep 2014 19:30:27 +0400 Subject: [PATCH] fixed evaluation in a class with empty package --- .../ui/impl/watch/CompilingEvaluator.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java index 439bff108409..467cf985f04c 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluator.java @@ -27,7 +27,6 @@ import com.intellij.debugger.jdi.VirtualMachineProxyImpl; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Computable; -import com.intellij.openapi.util.Key; import com.intellij.psi.PsiClass; import com.intellij.psi.PsiCodeFragment; import com.intellij.psi.PsiElement; @@ -152,7 +151,7 @@ public class CompilingEvaluator implements ExpressionEvaluator { classLoader.invokeMethod(threadReference, defineMethod, args, ClassType.INVOKE_SINGLE_THREADED); } } - return (ClassType)process.findClass(context, getGenPackageName() + '.' + getGenClassName(), classLoader); + return (ClassType)process.findClass(context, getGenClassFullName(), classLoader); } private static byte[] changeSuperToMagicAccessor(byte[] bytes) { @@ -230,13 +229,26 @@ public class CompilingEvaluator implements ExpressionEvaluator { } private String getMainClassName() { - return ((PsiClass)myData.getGeneratedInnerClass().getParent()).getName(); + return ApplicationManager.getApplication().runReadAction(new Computable() { + @Override + public String compute() { + return ((PsiClass)myData.getGeneratedInnerClass().getParent()).getName(); + } + }); } private String getGenClassName() { return getMainClassName() + '$' + GEN_CLASS_NAME; } + private String getGenClassFullName() { + String packageName = getGenPackageName(); + if (packageName.isEmpty()) { + return getGenClassName(); + } + return packageName + '.' + getGenClassName(); + } + //private String createClassCode() { // return ApplicationManager.getApplication().runReadAction(new Computable() { // @Override