properties: do not process non-String fields in PropertiesReferenceContributor &...
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Mon, 26 Sep 2016 09:32:30 +0000 (12:32 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Mon, 26 Sep 2016 09:32:58 +0000 (12:32 +0300)
plugins/java-i18n/src/com/intellij/lang/properties/PropertiesReferenceContributor.java

index 4a58e0f6496830769a759af19a62fdff3faa37bd..14f28163689ea16eab0e225a7628da0419cf5380 100644 (file)
@@ -62,7 +62,9 @@ public class PropertiesReferenceContributor extends PsiReferenceContributor{
           return PsiReference.EMPTY_ARRAY;
         }
         final PsiField field = (PsiField)parent;
-        if (field.getInitializer() != element || !field.hasModifierProperty(PsiModifier.FINAL)) {
+        if (field.getInitializer() != element ||
+            !field.hasModifierProperty(PsiModifier.FINAL) ||
+            !field.getType().equalsToText(CommonClassNames.JAVA_LANG_STRING)) {
           return PsiReference.EMPTY_ARRAY;
         }
         List<PsiReference> references = new ArrayList<>();
@@ -80,6 +82,7 @@ public class PropertiesReferenceContributor extends PsiReferenceContributor{
                   final PsiAnnotationMemberValue value = pair.getValue();
                   if (value instanceof PsiReferenceExpression && ((PsiReferenceExpression)value).resolve() == field) {
                     Collections.addAll(references, myUnderlying.getReferencesByElement(element, context));
+                    return false;
                   }
                 }
               }