NPE
authorAlexey Kudravtsev <cdr@intellij.com>
Thu, 27 May 2010 09:33:11 +0000 (13:33 +0400)
committerAlexey Kudravtsev <cdr@intellij.com>
Thu, 27 May 2010 10:04:43 +0000 (14:04 +0400)
java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java
java/java-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocParamRef.java

index 961edd5823737b17ce6e1f0137c07390a8a72e62..a5f75d1b622990e522a5ea23d4cb23b0174cb09b 100644 (file)
@@ -315,16 +315,14 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
   }
 
   @Override public void visitDocTagValue(PsiDocTagValue value) {
-    if (value.getReference() != null) {
-      PsiReference reference = value.getReference();
-      if (reference != null) {
-        PsiElement element = reference.resolve();
-        if (element instanceof PsiMethod) {
-          myHolder.add(HighlightNamesUtil.highlightMethodName((PsiMethod)element, ((PsiDocMethodOrFieldRef)value).getNameElement(), false));
-        }
-        else if (element instanceof PsiParameter) {
-          myHolder.add(HighlightNamesUtil.highlightVariable((PsiVariable)element, value.getNavigationElement()));
-        }
+    PsiReference reference = value.getReference();
+    if (reference != null) {
+      PsiElement element = reference.resolve();
+      if (element instanceof PsiMethod) {
+        myHolder.add(HighlightNamesUtil.highlightMethodName((PsiMethod)element, ((PsiDocMethodOrFieldRef)value).getNameElement(), false));
+      }
+      else if (element instanceof PsiParameter) {
+        myHolder.add(HighlightNamesUtil.highlightVariable((PsiVariable)element, value.getNavigationElement()));
       }
     }
   }
index d46e566e3b9999a04af57a02705afaa70254496d..05f00f4589f91cd1d4b4822c7293bd89cd5db51e 100644 (file)
@@ -50,7 +50,7 @@ public class PsiDocParamRef extends CompositePsiElement implements PsiDocTagValu
 
   public PsiReference getReference() {
     PsiReference cachedReference = myCachedReference;
-    if (cachedReference != null) return cachedReference;
+    if (cachedReference != null && cachedReference.getElement().isValid()) return cachedReference;
     final PsiDocComment comment = PsiTreeUtil.getParentOfType(this, PsiDocComment.class);
     if (comment == null) return null;
     final PsiDocCommentOwner owner = comment.getOwner();