< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
Print this page
*** 2564,2574 ****
}
case TRY: {
nextToken();
List<JCTree> resources = List.nil();
if (token.kind == LPAREN) {
- checkSourceLevel(Feature.TRY_WITH_RESOURCES);
nextToken();
resources = resources();
accept(RPAREN);
}
JCBlock body = block();
--- 2564,2573 ----
*** 2580,2594 ****
nextToken();
finalizer = block();
}
} else {
if (resources.isEmpty()) {
- if (Feature.TRY_WITH_RESOURCES.allowedInSource(source)) {
log.error(DiagnosticFlag.SYNTAX, pos, Errors.TryWithoutCatchFinallyOrResourceDecls);
- } else {
- log.error(DiagnosticFlag.SYNTAX, pos, Errors.TryWithoutCatchOrFinally);
- }
}
}
return F.at(pos).Try(resources, body, catchers.toList(), finalizer);
}
case SWITCH: {
--- 2579,2589 ----
*** 2697,2707 ****
List<JCExpression> catchTypes() {
ListBuffer<JCExpression> catchTypes = new ListBuffer<>();
catchTypes.add(parseType());
while (token.kind == BAR) {
- checkSourceLevel(Feature.MULTICATCH);
nextToken();
// Instead of qualident this is now parseType.
// But would that allow too much, e.g. arrays or generics?
catchTypes.add(parseType());
}
--- 2692,2701 ----
< prev index next >