Skip to content

Commit f453166

Browse files
lgxbslgxlahodaj
authored andcommitted
8267578: Remove unnecessary preview checks
Reviewed-by: jlahoda
1 parent 49f622c commit f453166

File tree

3 files changed

+3
-10
lines changed

3 files changed

+3
-10
lines changed

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,7 @@ protected Attr(Context context) {
167167
allowLambda = Feature.LAMBDA.allowedInSource(source);
168168
allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source);
169169
allowStaticInterfaceMethods = Feature.STATIC_INTERFACE_METHODS.allowedInSource(source);
170-
allowReifiableTypesInInstanceof =
171-
Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source) &&
172-
(!preview.isPreview(Feature.REIFIABLE_TYPES_INSTANCEOF) || preview.isEnabled());
170+
allowReifiableTypesInInstanceof = Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source);
173171
allowRecords = Feature.RECORDS.allowedInSource(source);
174172
sourceName = source.name;
175173
useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
@@ -3996,9 +3994,6 @@ public void visitTypeTest(JCInstanceOf tree) {
39963994
if (!clazztype.isErroneous() && !types.isReifiable(clazztype)) {
39973995
boolean valid = false;
39983996
if (allowReifiableTypesInInstanceof) {
3999-
if (preview.isPreview(Feature.REIFIABLE_TYPES_INSTANCEOF)) {
4000-
preview.warnPreview(tree.expr.pos(), Feature.REIFIABLE_TYPES_INSTANCEOF);
4001-
}
40023997
Warner warner = new Warner();
40033998
if (!types.isCastable(exprtype, clazztype, warner)) {
40043999
chk.basicHandler.report(tree.expr.pos(),

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ protected Resolve(Context context) {
146146
Target target = Target.instance(context);
147147
allowFunctionalInterfaceMostSpecific = Feature.FUNCTIONAL_INTERFACE_MOST_SPECIFIC.allowedInSource(source);
148148
allowLocalVariableTypeInference = Feature.LOCAL_VARIABLE_TYPE_INFERENCE.allowedInSource(source);
149-
allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
150-
Feature.SWITCH_EXPRESSION.allowedInSource(source);
149+
allowYieldStatement = Feature.SWITCH_EXPRESSION.allowedInSource(source);
151150
checkVarargsAccessAfterResolution =
152151
Feature.POST_APPLICABILITY_VARARGS_ACCESS_CHECK.allowedInSource(source);
153152
polymorphicSignatureScope = WriteableScope.create(syms.noSymbol);

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ protected JavacParser(ParserFactory fac,
183183
this.keepLineMap = keepLineMap;
184184
this.errorTree = F.Erroneous();
185185
endPosTable = newEndPosTable(keepEndPositions);
186-
this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
187-
Feature.SWITCH_EXPRESSION.allowedInSource(source);
186+
this.allowYieldStatement = Feature.SWITCH_EXPRESSION.allowedInSource(source);
188187
this.allowRecords = Feature.RECORDS.allowedInSource(source);
189188
this.allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source);
190189
}

0 commit comments

Comments
 (0)