< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
Print this page
@@ -2564,11 +2564,10 @@
}
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();
@@ -2580,15 +2579,11 @@
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: {
@@ -2697,11 +2692,10 @@
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());
}
< prev index next >