diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java index 1c98cf154a09..bf62af9e729d 100644 --- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java @@ -1212,7 +1212,7 @@ public final class PsiUtil extends PsiUtilCore { return expression; } - public static PsiElement skipParenthesizedExprUp(PsiElement parent) { + public static PsiElement skipParenthesizedExprUp(@Nullable PsiElement parent) { while (parent instanceof PsiParenthesizedExpression) { parent = parent.getParent(); } diff --git a/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java b/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java index cc0afcc4428f..ea49588fb8e5 100644 --- a/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java +++ b/plugins/java-i18n/src/com/intellij/lang/properties/PrefixBasedPropertyReference.java @@ -42,6 +42,7 @@ public class PrefixBasedPropertyReference extends PropertyReference { super(key, element, bundleName, soft); } + @Override @NotNull protected String getKeyText() { String keyText = super.getKeyText(); @@ -50,6 +51,7 @@ public class PrefixBasedPropertyReference extends PropertyReference { return keyText; } + @Override protected void addKey(Object property, Set variants) { String key = ((IProperty)property).getUnescapedKey(); final String keyPrefix = getKeyPrefix(); diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java index 4c2d1e383170..4330395bf633 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReference.java @@ -42,6 +42,7 @@ public class PropertyReference extends PropertyReferenceBase implements LocalQui myBundleName = bundleName; } + @Override @Nullable protected List getPropertiesFiles() { if (myBundleName == null) { @@ -54,6 +55,7 @@ public class PropertyReference extends PropertyReferenceBase implements LocalQui return I18nUtil.propertiesFilesByBundleName(bundleName, element); } + @Override public LocalQuickFix[] getQuickFixes() { List propertiesFiles = retrievePropertyFilesByBundleName(myBundleName, getElement()); LocalQuickFix fix = PropertiesQuickFixFactory.getInstance().createCreatePropertyFix(myElement, myKey, propertiesFiles); diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java index a7659062b93b..306329525d1b 100644 --- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java +++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/references/PropertyReferenceBase.java @@ -60,6 +60,7 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, myTextRange = range; } + @Override public PsiElement resolve() { ResolveResult[] resolveResults = multiResolve(false); return resolveResults.length == 1 ? resolveResults[0].getElement() : null; @@ -70,6 +71,7 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, return myKey; } + @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; @@ -78,25 +80,30 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, return getElement() == other.getElement() && getKeyText().equals(other.getKeyText()); } + @Override public int hashCode() { return getKeyText().hashCode(); } + @Override @NotNull public PsiElement getElement() { return myElement; } + @Override @NotNull public TextRange getRangeInElement() { return myTextRange; } + @Override @NotNull public String getCanonicalText() { return myKey; } + @Override public PsiElement handleElementRename(String newElementName) throws IncorrectOperationException { /*PsiElementFactory factory = JavaPsiFacade.getInstance(myElement.getProject()).getElementFactory(); @@ -114,10 +121,12 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, /*}*/ } + @Override public PsiElement bindToElement(@NotNull PsiElement element) throws IncorrectOperationException { throw new IncorrectOperationException("not implemented"); } + @Override public boolean isReferenceTo(PsiElement element) { if (!isProperty(element)) return false; for (ResolveResult result : multiResolve(false)) { @@ -135,15 +144,18 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, mySoft = soft; } + @Override public boolean isSoft() { return mySoft; } + @Override @NotNull public String getUnresolvedMessagePattern() { return PropertiesBundle.message("unresolved.property.key"); } + @Override @NotNull public ResolveResult[] multiResolve(final boolean incompleteCode) { final String key = getKeyText(); @@ -168,7 +180,8 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, return getResolveResults(properties); } - protected static ResolveResult[] getResolveResults(List properties) { + @NotNull + private static ResolveResult[] getResolveResults(List properties) { if (properties.isEmpty()) return ResolveResult.EMPTY_ARRAY; final ResolveResult[] results = new ResolveResult[properties.size()]; @@ -183,6 +196,7 @@ public abstract class PropertyReferenceBase implements PsiPolyVariantReference, @Nullable protected abstract List getPropertiesFiles(); + @Override @NotNull public Object[] getVariants() { return ArrayUtil.EMPTY_OBJECT_ARRAY;