< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java

Print this page

        

@@ -3178,17 +3178,17 @@
         JCTree elemType = TreeInfo.innermostType(type, true);
         int startPos = Position.NOPOS;
         if (elemType.hasTag(IDENT)) {
             Name typeName = ((JCIdent)elemType).name;
             if (isRestrictedLocalVarTypeName(typeName, pos, !compound && localDecl)) {
-                if (compound) {
-                    //error - 'var' in compound local var decl
-                   reportSyntaxError(pos, Errors.VarNotAllowedCompound);
-                } else if (type.hasTag(TYPEARRAY)) {
+                if (type.hasTag(TYPEARRAY) && !compound) {
                     //error - 'var' and arrays
                     reportSyntaxError(pos, Errors.VarNotAllowedArray);
                 } else {
+                    if(compound)
+                        //error - 'var' in compound local var decl
+                        reportSyntaxError(pos, Errors.VarNotAllowedCompound);
                     startPos = TreeInfo.getStartPos(mods);
                     if (startPos == Position.NOPOS)
                         startPos = TreeInfo.getStartPos(type);
                     //implicit type
                     type = null;
< prev index next >