Skip to content

Commit d737978

Browse files
committed
8343477: Remove unnecessary @SuppressWarnings annotations (compiler)
Reviewed-by: darcy, mcimadamore
1 parent 8133eb2 commit d737978

File tree

17 files changed

+11
-29
lines changed

17 files changed

+11
-29
lines changed

make/jdk/src/classes/build/tools/depend/Depend.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -446,7 +446,7 @@ public Void visitType(TypeElement e, Void p) {
446446
}
447447

448448
@Override
449-
public Void visitRecordComponent(@SuppressWarnings("preview")RecordComponentElement e, Void p) {
449+
public Void visitRecordComponent(RecordComponentElement e, Void p) {
450450
update(e.getSimpleName());
451451
visit(e.asType());
452452
return null;

make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java

-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ public class CreateSymbols {
228228
/**Create sig files for ct.sym reading the classes description from the directory that contains
229229
* {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
230230
*/
231-
@SuppressWarnings("unchecked")
232231
public void createSymbols(String ctDescriptionFileExtra, String ctDescriptionFile, String ctSymLocation,
233232
long timestamp, String currentVersion, String preReleaseTag, String moduleClasses,
234233
String includedModulesFile) throws IOException {
@@ -4634,7 +4633,6 @@ private static AnnotationDescription parseAnnotation(String value, int[] valuePo
46344633
/**Create sig files for ct.sym reading the classes description from the directory that contains
46354634
* {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
46364635
*/
4637-
@SuppressWarnings("unchecked")
46384636
public void createJavadocData(String ctDescriptionFileExtra, String ctDescriptionFile,
46394637
String targetDir, int startVersion) throws IOException {
46404638
LoadDescriptions data = load(ctDescriptionFileExtra != null ? Paths.get(ctDescriptionFileExtra)

src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java

-1
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ private void scanPlatformPath(PackageSymbol p) throws IOException {
719719
EnumSet.of(JavaFileObject.Kind.CLASS)));
720720
}
721721
// where
722-
@SuppressWarnings("fallthrough")
723722
private void fillIn(PackageSymbol p,
724723
Location location,
725724
Iterable<JavaFileObject> files)

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java

-1
Original file line numberDiff line numberDiff line change
@@ -1694,7 +1694,6 @@ public List<Type> getPermittedSubclasses() {
16941694

16951695
/** A class for variable symbols
16961696
*/
1697-
@SuppressWarnings("preview")
16981697
public static class VarSymbol extends Symbol implements VariableElement {
16991698

17001699
/** The variable's declaration position.

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java

-2
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ public List<TypeMetadata> getMetadata() {
361361
/**
362362
* Get the type metadata of the given kind associated with this type (if any).
363363
*/
364-
@SuppressWarnings("unchecked")
365364
public <M extends TypeMetadata> M getMetadata(Class<M> metadataClass) {
366365
return getMetadata(metadataClass, Function.identity(), null);
367366
}
@@ -2133,7 +2132,6 @@ public final void addBound(InferenceBound ib, Type bound, Types types) {
21332132
addBound(ib, bound, types, false);
21342133
}
21352134

2136-
@SuppressWarnings("fallthrough")
21372135
private void addBound(InferenceBound ib, Type bound, Types types, boolean update) {
21382136
if (kind == Kind.CAPTURED && !update) {
21392137
//Captured inference variables bounds must not be updated during incorporation,

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -611,7 +611,6 @@ public void scan() {
611611
}
612612

613613
@Override
614-
@SuppressWarnings("unchecked")
615614
public void scan(JCTree tree) {
616615
if (tree != null) {
617616
for (StatementAnalyzer<JCTree, JCTree> analyzer : analyzers) {

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

-2
Original file line numberDiff line numberDiff line change
@@ -3282,7 +3282,6 @@ void markDead() {
32823282
//do nothing
32833283
}
32843284

3285-
@SuppressWarnings("fallthrough")
32863285
void checkEffectivelyFinal(DiagnosticPosition pos, VarSymbol sym) {
32873286
if (currentTree != null &&
32883287
sym.owner.kind == MTH &&
@@ -3303,7 +3302,6 @@ int getCurrentTreeStartPosition() {
33033302
: currentTree.getStartPosition();
33043303
}
33053304

3306-
@SuppressWarnings("fallthrough")
33073305
void letInit(JCTree tree) {
33083306
tree = TreeInfo.skipParens(tree);
33093307
if (tree.hasTag(IDENT) || tree.hasTag(SELECT)) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ public UsesProvidesVisitor(ModuleSymbol msym, Env<AttrContext> env) {
10231023
this.env = env;
10241024
}
10251025

1026-
@Override @SuppressWarnings("unchecked")
1026+
@Override
10271027
public void visitModuleDef(JCModuleDecl tree) {
10281028
msym.directives = List.nil();
10291029
msym.provides = List.nil();

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -274,7 +274,6 @@ abstract class OperatorHelper {
274274
/** An array of operator symbol suppliers (used to lazily populate the symbol list). */
275275
List<Supplier<OperatorSymbol>> operatorSuppliers = List.nil();
276276

277-
@SuppressWarnings("varargs")
278277
OperatorHelper(Tag tag) {
279278
this.name = operatorName(tag);
280279
}

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

-1
Original file line numberDiff line numberDiff line change
@@ -5193,7 +5193,6 @@ DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceCo
51935193
* while inapplicable candidates contain further details about the
51945194
* reason why the method has been considered inapplicable.
51955195
*/
5196-
@SuppressWarnings("overrides")
51975196
class Candidate {
51985197

51995198
final MethodResolutionPhase step;

src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/JNIWriter.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -339,7 +339,6 @@ && isNative(md2)) {
339339
}
340340
}
341341
}
342-
@SuppressWarnings("fallthrough")
343342
protected final String jniType(Type t) {
344343
switch (t.getKind()) {
345344
case ARRAY: {
@@ -442,7 +441,6 @@ static enum EncoderType {
442441
JNI,
443442
SIGNATURE
444443
}
445-
@SuppressWarnings("fallthrough")
446444
static String encode(CharSequence name, EncoderType mtype) {
447445
StringBuilder result = new StringBuilder(100);
448446
int length = name.length();

src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -220,7 +220,7 @@ public void visitArray(Attribute.Array a) {
220220
}
221221
}
222222

223-
@SuppressWarnings({"unchecked", "rawtypes"})
223+
@SuppressWarnings("unchecked")
224224
public void visitEnum(Attribute.Enum e) {
225225
if (returnClass.isEnum()) {
226226
String constName = e.value.toString();

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

-2
Original file line numberDiff line numberDiff line change
@@ -2834,7 +2834,6 @@ public JCBlock block() {
28342834
* LocalVariableDeclarationStatement
28352835
* = { FINAL | '@' Annotation } Type VariableDeclarators ";"
28362836
*/
2837-
@SuppressWarnings("fallthrough")
28382837
List<JCStatement> blockStatements() {
28392838
//todo: skip to anchor on error(?)
28402839
int lastErrPos = -1;
@@ -2892,7 +2891,6 @@ JCStatement parseStatementAsBlock() {
28922891

28932892
/**This method parses a statement appearing inside a block.
28942893
*/
2895-
@SuppressWarnings("fallthrough")
28962894
List<JCStatement> blockStatement() {
28972895
//todo: skip to anchor on error(?)
28982896
Comment dc;

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -107,7 +107,6 @@ public class UnicodeReader {
107107
* @param array array containing contents of source.
108108
* @param length length of meaningful content in buffer.
109109
*/
110-
@SuppressWarnings("this-escape")
111110
protected UnicodeReader(ScannerFactory sf, char[] array, int length) {
112111
this(sf.log, array, length);
113112
}

src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java

-1
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,6 @@ public List<JCTypeParameter> getTypeParameters() {
886886
public List<JCExpression> getImplementsClause() {
887887
return implementing;
888888
}
889-
@SuppressWarnings("removal")
890889
@DefinedBy(Api.COMPILER_TREE)
891890
public List<JCExpression> getPermitsClause() {
892891
return permitting;

src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -151,7 +151,7 @@ public static <A> List<A> of(A x1, A x2, A x3) {
151151

152152
/** Construct a list consisting of given elements.
153153
*/
154-
@SuppressWarnings({"varargs", "unchecked"})
154+
@SuppressWarnings("unchecked")
155155
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
156156
return new List<>(x1, new List<>(x2, new List<>(x3, from(rest))));
157157
}

src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java

-1
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,6 @@ public static class RichConfiguration extends ForwardingDiagnosticFormatter.Forw
652652
/** set of enabled rich formatter's features */
653653
protected java.util.EnumSet<RichFormatterFeature> features;
654654

655-
@SuppressWarnings("fallthrough")
656655
public RichConfiguration(Options options, AbstractDiagnosticFormatter formatter) {
657656
super(formatter.getConfiguration());
658657
features = formatter.isRaw() ? EnumSet.noneOf(RichFormatterFeature.class) :

0 commit comments

Comments
 (0)