IDEA-151710 Accessing (in Java) to kotlin enum entry evaluates to NPE phpstorm/144.4232
authorEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 16 Feb 2016 10:56:03 +0000 (13:56 +0300)
committerEgor.Ushakov <egor.ushakov@jetbrains.com>
Tue, 16 Feb 2016 10:57:08 +0000 (13:57 +0300)
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/EvaluatorBuilderImpl.java
java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/TypeEvaluator.java

index 3ae196e8d84b4fba405b9f6ac6f2edbb5ec824e2..291407a2989d808d7a6a559f576241b934cdf1ec 100644 (file)
@@ -685,7 +685,11 @@ public class EvaluatorBuilderImpl implements EvaluatorBuilder {
         }
         Evaluator objectEvaluator;
         if (psiField.hasModifierProperty(PsiModifier.STATIC)) {
-          objectEvaluator = new TypeEvaluator(JVMNameUtil.getContextClassJVMQualifiedName(SourcePosition.createFromElement(psiField)));
+          JVMName className = JVMNameUtil.getContextClassJVMQualifiedName(SourcePosition.createFromElement(psiField));
+          if (className == null) {
+            className = JVMNameUtil.getJVMQualifiedName(fieldClass);
+          }
+          objectEvaluator = new TypeEvaluator(className);
         }
         else if(qualifier != null) {
           qualifier.accept(this);
index 1ba045776258f18c2c389dc6c3f417073ab29295..8af88a3d62aa03caa6fa55cc634a9ad8bd1e2502 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2016 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.
@@ -27,11 +27,12 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
 import com.intellij.debugger.engine.evaluation.EvaluateExceptionUtil;
 import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
 import com.sun.jdi.ReferenceType;
+import org.jetbrains.annotations.NotNull;
 
 public class TypeEvaluator implements Evaluator {
   private final JVMName myTypeName;
 
-  public TypeEvaluator(JVMName typeName) {
+  public TypeEvaluator(@NotNull JVMName typeName) {
     myTypeName = typeName;
   }