8189749: Devise strategy for making source level checks more uniform

Create a 'feature' enum which is responsible for handling source version checks and related diagnostic generation

Reviewed-by: jjg, jlahoda
This commit is contained in:
Maurizio Cimadamore 2017-12-04 17:54:49 +00:00
parent 3a458b1aa1
commit 686d74f11e
84 changed files with 475 additions and 586 deletions

View file

@ -21,6 +21,7 @@
* questions.
*/
import com.sun.tools.javac.code.Source.Feature;
import com.sun.tools.javac.code.TypeTag;
import com.sun.tools.javac.parser.JavacParser;
import com.sun.tools.javac.parser.ParserFactory;
@ -186,7 +187,7 @@ class TrialParser extends JavacParser {
List<JCAnnotation> annosAfterParams = annotationsOpt(Tag.ANNOTATION);
if (annosAfterParams.nonEmpty()) {
checkAnnotationsAfterTypeParams(annosAfterParams.head.pos);
checkSourceLevel(annosAfterParams.head.pos, Feature.ANNOTATIONS_AFTER_TYPE_PARAMS);
mods.annotations = mods.annotations.appendList(annosAfterParams);
if (mods.pos == Position.NOPOS) {
mods.pos = mods.annotations.head.pos;