langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
changeset 7211 163fe60f63de
parent 7076 c96fa26247c8
child 7636 030f141aa32b
equal deleted inserted replaced
7210:8dd5f907461e 7211:163fe60f63de
  1710         }
  1710         }
  1711         case TRY: {
  1711         case TRY: {
  1712             S.nextToken();
  1712             S.nextToken();
  1713             List<JCTree> resources = List.<JCTree>nil();
  1713             List<JCTree> resources = List.<JCTree>nil();
  1714             if (S.token() == LPAREN) {
  1714             if (S.token() == LPAREN) {
  1715                 checkAutomaticResourceManagement();
  1715                 checkTryWithResources();
  1716                 S.nextToken();
  1716                 S.nextToken();
  1717                 resources = resources();
  1717                 resources = resources();
  1718                 accept(RPAREN);
  1718                 accept(RPAREN);
  1719             }
  1719             }
  1720             JCBlock body = block();
  1720             JCBlock body = block();
  2968         if (!allowMulticatch) {
  2968         if (!allowMulticatch) {
  2969             error(S.pos(), "multicatch.not.supported.in.source", source.name);
  2969             error(S.pos(), "multicatch.not.supported.in.source", source.name);
  2970             allowMulticatch = true;
  2970             allowMulticatch = true;
  2971         }
  2971         }
  2972     }
  2972     }
  2973     void checkAutomaticResourceManagement() {
  2973     void checkTryWithResources() {
  2974         if (!allowTWR) {
  2974         if (!allowTWR) {
  2975             error(S.pos(), "automatic.resource.management.not.supported.in.source", source.name);
  2975             error(S.pos(), "try.with.resources.not.supported.in.source", source.name);
  2976             allowTWR = true;
  2976             allowTWR = true;
  2977         }
  2977         }
  2978     }
  2978     }
  2979 }
  2979 }