groovy hasModifierProperty: don't resolve annotations unless really needed (EA-64982...
authorpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 12:59:43 +0000 (13:59 +0100)
committerpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 15:18:47 +0000 (16:18 +0100)
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/auxiliary/modifiers/GrModifierListImpl.java

index 6fa2c5e3f403f226baa2b54b2d135ab2a6bbd7d7..41d6f98ef7113b5cad9a7989527a430a9531d006 100644 (file)
@@ -189,10 +189,10 @@ public class GrModifierListImpl extends GrStubElementBase<GrModifierListStub> im
         if (modifier.equals(GrModifier.STATIC)) return true;
         if (modifier.equals(GrModifier.FINAL)) return true;
       }
-      if (pParent instanceof GrTypeDefinition) {
+      if (pParent instanceof GrTypeDefinition && modifier.equals(GrModifier.FINAL) && !modifierList.hasExplicitVisibilityModifiers()) {
         PsiModifierList pModifierList = ((GrTypeDefinition)pParent).getModifierList();
-        if (pModifierList != null && !modifierList.hasExplicitVisibilityModifiers() && PsiImplUtil.hasImmutableAnnotation(pModifierList)) {
-          if (modifier.equals(GrModifier.FINAL)) return true;
+        if (pModifierList != null && PsiImplUtil.hasImmutableAnnotation(pModifierList)) {
+          return true;
         }
       }
     }