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

Print this page

        

*** 1637,1647 **** * | FOR "(" ForInitOpt ";" [Expression] ";" ForUpdateOpt ")" Statement * | FOR "(" FormalParameter : Expression ")" Statement * | WHILE ParExpression Statement * | DO Statement WHILE ParExpression ";" * | TRY Block ( Catches | [Catches] FinallyPart ) ! * | TRY "(" ResourceSpecification ")" Block [Catches] [FinallyPart] * | SWITCH ParExpression "{" SwitchBlockStatementGroups "}" * | SYNCHRONIZED ParExpression Block * | RETURN [Expression] ";" * | THROW Expression ";" * | BREAK [Ident] ";" --- 1637,1647 ---- * | FOR "(" ForInitOpt ";" [Expression] ";" ForUpdateOpt ")" Statement * | FOR "(" FormalParameter : Expression ")" Statement * | WHILE ParExpression Statement * | DO Statement WHILE ParExpression ";" * | TRY Block ( Catches | [Catches] FinallyPart ) ! * | TRY "(" ResourceSpecification ";"opt ")" Block [Catches] [FinallyPart] * | SWITCH ParExpression "{" SwitchBlockStatementGroups "}" * | SYNCHRONIZED ParExpression Block * | RETURN [Expression] ";" * | THROW Expression ";" * | BREAK [Ident] ";"
*** 2180,2196 **** */ List<JCTree> resources() { ListBuffer<JCTree> defs = new ListBuffer<JCTree>(); defs.append(resource()); while (S.token() == SEMI) { ! // All but last of multiple declarators subsume a semicolon storeEnd(defs.elems.last(), S.endPos()); int semiColonPos = S.pos(); S.nextToken(); ! if (S.token() == RPAREN) { // Illegal trailing semicolon // after last resource - error(semiColonPos, "try.resource.trailing.semi"); break; } defs.append(resource()); } return defs.toList(); --- 2180,2195 ---- */ List<JCTree> resources() { ListBuffer<JCTree> defs = new ListBuffer<JCTree>(); defs.append(resource()); while (S.token() == SEMI) { ! // All but last of multiple declarators must subsume a semicolon storeEnd(defs.elems.last(), S.endPos()); int semiColonPos = S.pos(); S.nextToken(); ! if (S.token() == RPAREN) { // Optional trailing semicolon // after last resource break; } defs.append(resource()); } return defs.toList();