diff -r 14e098407bb0 -r ad69fd32778e src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Oct 21 15:11:44 2019 +0200 +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java Mon Oct 21 15:38:26 2019 +0200 @@ -1395,20 +1395,27 @@ repeatable = proxy; } else if (proxy.type.tsym == syms.deprecatedType.tsym) { sym.flags_field |= (DEPRECATED | DEPRECATED_ANNOTATION); - for (Pair v : proxy.values) { - if (v.fst == names.forRemoval && v.snd instanceof Attribute.Constant) { - Attribute.Constant c = (Attribute.Constant)v.snd; - if (c.type == syms.booleanType && ((Integer)c.value) != 0) { - sym.flags_field |= DEPRECATED_REMOVAL; - } - } - } + setFlagIfAttributeTrue(proxy, sym, names.forRemoval, DEPRECATED_REMOVAL); + } else if (proxy.type.tsym == syms.previewFeatureType.tsym) { + sym.flags_field |= PREVIEW_API; + setFlagIfAttributeTrue(proxy, sym, names.essentialAPI, PREVIEW_ESSENTIAL_API); } proxies.append(proxy); } } annotate.normal(new AnnotationCompleter(sym, proxies.toList())); } + //where: + private void setFlagIfAttributeTrue(CompoundAnnotationProxy proxy, Symbol sym, Name attribute, long flag) { + for (Pair v : proxy.values) { + if (v.fst == attribute && v.snd instanceof Attribute.Constant) { + Attribute.Constant c = (Attribute.Constant)v.snd; + if (c.type == syms.booleanType && ((Integer)c.value) != 0) { + sym.flags_field |= flag; + } + } + } + } /** Read parameter annotations. */