src/share/classes/com/sun/tools/javac/parser/JavacParser.java
Print this page
@@ -1637,11 +1637,11 @@
* | 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]
+ * | TRY "(" ResourceSpecification ";"opt ")" Block [Catches] [FinallyPart]
* | SWITCH ParExpression "{" SwitchBlockStatementGroups "}"
* | SYNCHRONIZED ParExpression Block
* | RETURN [Expression] ";"
* | THROW Expression ";"
* | BREAK [Ident] ";"
@@ -2180,17 +2180,16 @@
*/
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
+ // 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) { // Illegal trailing semicolon
+ if (S.token() == RPAREN) { // Optional trailing semicolon
// after last resource
- error(semiColonPos, "try.resource.trailing.semi");
break;
}
defs.append(resource());
}
return defs.toList();