diff --git a/source/com/intellij/codeInsight/CodeInsightUtil.java b/source/com/intellij/codeInsight/CodeInsightUtil.java index ac6c884f0858..e76f3fddf654 100644 --- a/source/com/intellij/codeInsight/CodeInsightUtil.java +++ b/source/com/intellij/codeInsight/CodeInsightUtil.java @@ -139,8 +139,8 @@ public class CodeInsightUtil { if (root instanceof TranslatingChangesDummyHolder) { root.accept(new PsiRecursiveElementVisitor(){ public void visitElement(PsiElement element) { - list.add(element); super.visitElement(element); + list.add(element); } }); return list.toArray(new PsiElement[list.size()]); diff --git a/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java b/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java index c45412c1755e..250e47657b25 100644 --- a/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java +++ b/source/com/intellij/codeInsight/daemon/impl/analysis/HighlightVisitorImpl.java @@ -167,7 +167,7 @@ public class HighlightVisitorImpl extends PsiElementVisitor implements Highlight } } - private HighlightInfo convertToHighlightInfo(final Annotation annotation) { + private static HighlightInfo convertToHighlightInfo(final Annotation annotation) { final HighlightInfo info = new HighlightInfo(annotation.getTextAttributes(), convertType(annotation), annotation.getStartOffset(), annotation.getEndOffset(), annotation.getMessage(), annotation.getTooltip(), annotation.getSeverity(), annotation.isAfterEndOfLine(), annotation.needsUpdateOnTyping()); final List> fixes = annotation.getQuickFixes(); @@ -180,7 +180,7 @@ public class HighlightVisitorImpl extends PsiElementVisitor implements Highlight return info; } - private HighlightInfoType convertType(Annotation annotation) { + private static HighlightInfoType convertType(Annotation annotation) { final ProblemHighlightType type = annotation.getHighlightType(); if (type == ProblemHighlightType.LIKE_UNUSED_SYMBOL) return HighlightInfoType.UNUSED_SYMBOL; if (type == ProblemHighlightType.LIKE_UNKNOWN_SYMBOL) return HighlightInfoType.WRONG_REF; @@ -729,9 +729,8 @@ public class HighlightVisitorImpl extends PsiElementVisitor implements Highlight myHolder.add(GenericsHighlightUtil.checkParameterizedReferenceTypeArguments(resolved, ref, result.getSubstitutor())); } - PsiElement refParent = parent; - if (resolved instanceof PsiClass && refParent instanceof PsiReferenceList) { - myHolder.add(HighlightUtil.checkReferenceList(ref, (PsiReferenceList)refParent, result)); + if (resolved instanceof PsiClass && parent instanceof PsiReferenceList) { + myHolder.add(HighlightUtil.checkReferenceList(ref, (PsiReferenceList)parent, result)); } if (!myHolder.hasErrorResults()) { @@ -898,7 +897,7 @@ public class HighlightVisitorImpl extends PsiElementVisitor implements Highlight } public void visitVariable(PsiVariable variable) { - myHolder.add(HighlightUtil.checkVariableInitializerType(variable)); + if (!myHolder.hasErrorResults()) myHolder.add(HighlightUtil.checkVariableInitializerType(variable)); myHolder.add(HighlightNamesUtil.highlightVariable(variable, variable.getNameIdentifier())); } diff --git a/source/com/intellij/psi/impl/PsiElementBase.java b/source/com/intellij/psi/impl/PsiElementBase.java index 208edd3b1749..909c622d7a58 100644 --- a/source/com/intellij/psi/impl/PsiElementBase.java +++ b/source/com/intellij/psi/impl/PsiElementBase.java @@ -4,19 +4,17 @@ package com.intellij.psi.impl; import com.intellij.ide.util.EditSourceUtil; import com.intellij.lang.Language; import com.intellij.navigation.ItemPresentation; +import com.intellij.navigation.NavigationItem; import com.intellij.openapi.project.Project; import com.intellij.openapi.vcs.FileStatus; -import com.intellij.psi.PsiElement; -import com.intellij.psi.PsiElementVisitor; -import com.intellij.psi.PsiReference; -import com.intellij.psi.PsiSubstitutor; +import com.intellij.psi.*; import com.intellij.psi.impl.source.resolve.ResolveUtil; import com.intellij.psi.scope.PsiScopeProcessor; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.search.SearchScope; import com.intellij.util.IncorrectOperationException; -public abstract class PsiElementBase extends ElementBase implements PsiElement { +public abstract class PsiElementBase extends ElementBase implements PsiElement,NavigationItem { public PsiElement getFirstChild() { PsiElement[] children = getChildren(); if (children.length == 0) return null; @@ -122,6 +120,10 @@ public abstract class PsiElementBase extends ElementBase implements PsiElement { return FileStatus.NOT_CHANGED; } + public String getName() { + return this instanceof PsiNamedElement ? ((PsiNamedElement)this).getName() : null; + } + public Project getProject() { return getManager().getProject(); }