langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
changeset 14267 6321fbe0cf50
parent 14263 473b1eaede64
child 14359 d4099818ab70
equal deleted inserted replaced
14266:69453558960d 14267:6321fbe0cf50
   114         this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true);
   114         this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true);
   115         this.allowLambda = source.allowLambda() &&
   115         this.allowLambda = source.allowLambda() &&
   116                 fac.options.isSet("allowLambda"); //pre-lambda guard
   116                 fac.options.isSet("allowLambda"); //pre-lambda guard
   117         this.allowMethodReferences = source.allowMethodReferences() &&
   117         this.allowMethodReferences = source.allowMethodReferences() &&
   118                 fac.options.isSet("allowMethodReferences"); //pre-lambda guard
   118                 fac.options.isSet("allowMethodReferences"); //pre-lambda guard
       
   119         this.allowDefaultMethods = source.allowDefaultMethods() &&
       
   120                 fac.options.isSet("allowDefaultMethods"); //pre-lambda guard
   119         this.keepDocComments = keepDocComments;
   121         this.keepDocComments = keepDocComments;
   120         docComments = newDocCommentTable(keepDocComments);
   122         docComments = newDocCommentTable(keepDocComments);
   121         this.keepLineMap = keepLineMap;
   123         this.keepLineMap = keepLineMap;
   122         this.errorTree = F.Erroneous();
   124         this.errorTree = F.Erroneous();
   123         endPosTable = newEndPosTable(keepEndPositions);
   125         endPosTable = newEndPosTable(keepEndPositions);
   182     boolean allowLambda;
   184     boolean allowLambda;
   183 
   185 
   184     /** Switch: should we allow method/constructor references?
   186     /** Switch: should we allow method/constructor references?
   185      */
   187      */
   186     boolean allowMethodReferences;
   188     boolean allowMethodReferences;
       
   189 
       
   190     /** Switch: should we allow default methods in interfaces?
       
   191      */
       
   192     boolean allowDefaultMethods;
   187 
   193 
   188     /** Switch: should we keep docComments?
   194     /** Switch: should we keep docComments?
   189      */
   195      */
   190     boolean keepDocComments;
   196     boolean keepDocComments;
   191 
   197 
  2309             case NATIVE      : flag = Flags.NATIVE; break;
  2315             case NATIVE      : flag = Flags.NATIVE; break;
  2310             case VOLATILE    : flag = Flags.VOLATILE; break;
  2316             case VOLATILE    : flag = Flags.VOLATILE; break;
  2311             case SYNCHRONIZED: flag = Flags.SYNCHRONIZED; break;
  2317             case SYNCHRONIZED: flag = Flags.SYNCHRONIZED; break;
  2312             case STRICTFP    : flag = Flags.STRICTFP; break;
  2318             case STRICTFP    : flag = Flags.STRICTFP; break;
  2313             case MONKEYS_AT  : flag = Flags.ANNOTATION; break;
  2319             case MONKEYS_AT  : flag = Flags.ANNOTATION; break;
       
  2320             case DEFAULT     : checkDefaultMethods(); flag = Flags.DEFAULT; break;
  2314             case ERROR       : flag = 0; nextToken(); break;
  2321             case ERROR       : flag = 0; nextToken(); break;
  2315             default: break loop;
  2322             default: break loop;
  2316             }
  2323             }
  2317             if ((flags & flag) != 0) error(token.pos, "repeated.modifier");
  2324             if ((flags & flag) != 0) error(token.pos, "repeated.modifier");
  2318             lastPos = token.pos;
  2325             lastPos = token.pos;
  3359         if (!allowMethodReferences) {
  3366         if (!allowMethodReferences) {
  3360             log.error(token.pos, "method.references.not.supported.in.source", source.name);
  3367             log.error(token.pos, "method.references.not.supported.in.source", source.name);
  3361             allowMethodReferences = true;
  3368             allowMethodReferences = true;
  3362         }
  3369         }
  3363     }
  3370     }
       
  3371     void checkDefaultMethods() {
       
  3372         if (!allowDefaultMethods) {
       
  3373             log.error(token.pos, "default.methods.not.supported.in.source", source.name);
       
  3374             allowDefaultMethods = true;
       
  3375         }
       
  3376     }
  3364 
  3377 
  3365     /*
  3378     /*
  3366      * a functional source tree and end position mappings
  3379      * a functional source tree and end position mappings
  3367      */
  3380      */
  3368     protected class SimpleEndPosTable extends AbstractEndPosTable {
  3381     protected class SimpleEndPosTable extends AbstractEndPosTable {