[groovy] fix AIOOBE in annotator (EA-87014)
authorDaniil Ovchinnikov <daniil.ovchinnikov@jetbrains.com>
Thu, 18 Aug 2016 11:55:40 +0000 (14:55 +0300)
committerDaniil Ovchinnikov <daniil.ovchinnikov@jetbrains.com>
Thu, 18 Aug 2016 12:54:17 +0000 (15:54 +0300)
plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/annotator/GroovyAnnotator.java

index 583f6b95dd659981327f5ebfd5497544a0e6b213..ea45c939091db4b6f53e9410fc3a72e740d7dd2a 100644 (file)
@@ -982,7 +982,10 @@ public class GroovyAnnotator extends GroovyElementVisitor {
   }
 
   private static void checkFieldModifiers(AnnotationHolder holder, GrVariableDeclaration fieldDeclaration) {
-    GrVariable variable = fieldDeclaration.getVariables()[0];
+    GrVariable[] variables = fieldDeclaration.getVariables();
+    if (variables.length == 0) return;
+
+    GrVariable variable = variables[0];
     if (!(variable instanceof GrField)) return;
 
     final GrField member = (GrField)variable;