diff --git a/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java b/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java index 448f6a951c7b..1bbaed22343b 100644 --- a/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java +++ b/codeInsight/impl/com/intellij/codeInsight/daemon/impl/analysis/HighlightNamesUtil.java @@ -34,8 +34,7 @@ public class HighlightNamesUtil { TextAttributes regularAttributes = HighlightInfo.getAttributesByType(type); if (element == null) return regularAttributes; TextAttributes scopeAttributes = getScopeAttributes(element); - TextAttributes attributes = TextAttributes.merge(scopeAttributes, regularAttributes); - return attributes; + return TextAttributes.merge(scopeAttributes, regularAttributes); } @Nullable @@ -46,9 +45,12 @@ public class HighlightNamesUtil { TextRange range = elementToHighlight.getTextRange(); if (elementToHighlight instanceof PsiJavaCodeReferenceElement) { final PsiJavaCodeReferenceElement referenceElement = (PsiJavaCodeReferenceElement)elementToHighlight; - final TextRange paramListRange = referenceElement.getParameterList().getTextRange(); - if (paramListRange.getEndOffset() > paramListRange.getStartOffset()) { - range = new TextRange(range.getStartOffset(), paramListRange.getStartOffset()); + PsiReferenceParameterList parameterList = referenceElement.getParameterList(); + if (parameterList != null) { + final TextRange paramListRange = parameterList.getTextRange(); + if (paramListRange.getEndOffset() > paramListRange.getStartOffset()) { + range = new TextRange(range.getStartOffset(), paramListRange.getStartOffset()); + } } } @@ -156,7 +158,7 @@ public class HighlightNamesUtil { for (NamedScope namedScope : scopes) { PackageSet packageSet = namedScope.getValue(); String name = namedScope.getName(); - if (packageSet.contains(file, namedScopeManager)) { + if (packageSet != null && packageSet.contains(file, namedScopeManager)) { TextAttributesKey scopeKey = ColorAndFontOptions.getScopeTextAttributeKey(name); TextAttributes attributes = scheme.getAttributes(scopeKey); if (attributes != null) return attributes; diff --git a/openapi/src/com/intellij/psi/search/scope/packageSet/NamedScope.java b/openapi/src/com/intellij/psi/search/scope/packageSet/NamedScope.java index 2a36e2859253..67adf26237b1 100644 --- a/openapi/src/com/intellij/psi/search/scope/packageSet/NamedScope.java +++ b/openapi/src/com/intellij/psi/search/scope/packageSet/NamedScope.java @@ -15,19 +15,24 @@ */ package com.intellij.psi.search.scope.packageSet; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; + public class NamedScope { private String myName; private PackageSet myValue; - public NamedScope(String name, PackageSet value) { + public NamedScope(@NotNull String name, @Nullable PackageSet value) { myName = name; myValue = value; } + @NotNull public String getName() { return myName; } + @Nullable public PackageSet getValue() { return myValue; }