8343477: Remove unnecessary @SuppressWarnings annotations (compiler)

Reviewed-by: darcy, mcimadamore
This commit is contained in:
Archie Cobbs
2024-12-16 14:52:42 +00:00
parent 8133eb2c28
commit d737978924
17 changed files with 11 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -446,7 +446,7 @@ public class Depend implements Plugin {
}
@Override
public Void visitRecordComponent(@SuppressWarnings("preview")RecordComponentElement e, Void p) {
public Void visitRecordComponent(RecordComponentElement e, Void p) {
update(e.getSimpleName());
visit(e.asType());
return null;

View File

@@ -228,7 +228,6 @@ public class CreateSymbols {
/**Create sig files for ct.sym reading the classes description from the directory that contains
* {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
*/
@SuppressWarnings("unchecked")
public void createSymbols(String ctDescriptionFileExtra, String ctDescriptionFile, String ctSymLocation,
long timestamp, String currentVersion, String preReleaseTag, String moduleClasses,
String includedModulesFile) throws IOException {
@@ -4634,7 +4633,6 @@ public class CreateSymbols {
/**Create sig files for ct.sym reading the classes description from the directory that contains
* {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
*/
@SuppressWarnings("unchecked")
public void createJavadocData(String ctDescriptionFileExtra, String ctDescriptionFile,
String targetDir, int startVersion) throws IOException {
LoadDescriptions data = load(ctDescriptionFileExtra != null ? Paths.get(ctDescriptionFileExtra)

View File

@@ -719,7 +719,6 @@ public class ClassFinder {
EnumSet.of(JavaFileObject.Kind.CLASS)));
}
// where
@SuppressWarnings("fallthrough")
private void fillIn(PackageSymbol p,
Location location,
Iterable<JavaFileObject> files)

View File

@@ -1694,7 +1694,6 @@ public abstract class Symbol extends AnnoConstruct implements PoolConstant, Elem
/** A class for variable symbols
*/
@SuppressWarnings("preview")
public static class VarSymbol extends Symbol implements VariableElement {
/** The variable's declaration position.

View File

@@ -361,7 +361,6 @@ public abstract class Type extends AnnoConstruct implements TypeMirror, PoolCons
/**
* Get the type metadata of the given kind associated with this type (if any).
*/
@SuppressWarnings("unchecked")
public <M extends TypeMetadata> M getMetadata(Class<M> metadataClass) {
return getMetadata(metadataClass, Function.identity(), null);
}
@@ -2133,7 +2132,6 @@ public abstract class Type extends AnnoConstruct implements TypeMirror, PoolCons
addBound(ib, bound, types, false);
}
@SuppressWarnings("fallthrough")
private void addBound(InferenceBound ib, Type bound, Types types, boolean update) {
if (kind == Kind.CAPTURED && !update) {
//Captured inference variables bounds must not be updated during incorporation,

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -611,7 +611,6 @@ public class Analyzer {
}
@Override
@SuppressWarnings("unchecked")
public void scan(JCTree tree) {
if (tree != null) {
for (StatementAnalyzer<JCTree, JCTree> analyzer : analyzers) {

View File

@@ -3282,7 +3282,6 @@ public class Flow {
//do nothing
}
@SuppressWarnings("fallthrough")
void checkEffectivelyFinal(DiagnosticPosition pos, VarSymbol sym) {
if (currentTree != null &&
sym.owner.kind == MTH &&
@@ -3303,7 +3302,6 @@ public class Flow {
: currentTree.getStartPosition();
}
@SuppressWarnings("fallthrough")
void letInit(JCTree tree) {
tree = TreeInfo.skipParens(tree);
if (tree.hasTag(IDENT) || tree.hasTag(SELECT)) {

View File

@@ -1023,7 +1023,7 @@ public class Modules extends JCTree.Visitor {
this.env = env;
}
@Override @SuppressWarnings("unchecked")
@Override
public void visitModuleDef(JCModuleDecl tree) {
msym.directives = List.nil();
msym.provides = List.nil();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -274,7 +274,6 @@ public class Operators {
/** An array of operator symbol suppliers (used to lazily populate the symbol list). */
List<Supplier<OperatorSymbol>> operatorSuppliers = List.nil();
@SuppressWarnings("varargs")
OperatorHelper(Tag tag) {
this.name = operatorName(tag);
}

View File

@@ -5193,7 +5193,6 @@ public class Resolve {
* while inapplicable candidates contain further details about the
* reason why the method has been considered inapplicable.
*/
@SuppressWarnings("overrides")
class Candidate {
final MethodResolutionPhase step;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -339,7 +339,6 @@ public class JNIWriter {
}
}
}
@SuppressWarnings("fallthrough")
protected final String jniType(Type t) {
switch (t.getKind()) {
case ARRAY: {
@@ -442,7 +441,6 @@ public class JNIWriter {
JNI,
SIGNATURE
}
@SuppressWarnings("fallthrough")
static String encode(CharSequence name, EncoderType mtype) {
StringBuilder result = new StringBuilder(100);
int length = name.length();

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -220,7 +220,7 @@ public class AnnotationProxyMaker {
}
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
public void visitEnum(Attribute.Enum e) {
if (returnClass.isEnum()) {
String constName = e.value.toString();

View File

@@ -2834,7 +2834,6 @@ public class JavacParser implements Parser {
* LocalVariableDeclarationStatement
* = { FINAL | '@' Annotation } Type VariableDeclarators ";"
*/
@SuppressWarnings("fallthrough")
List<JCStatement> blockStatements() {
//todo: skip to anchor on error(?)
int lastErrPos = -1;
@@ -2892,7 +2891,6 @@ public class JavacParser implements Parser {
/**This method parses a statement appearing inside a block.
*/
@SuppressWarnings("fallthrough")
List<JCStatement> blockStatement() {
//todo: skip to anchor on error(?)
Comment dc;

View File

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

View File

@@ -886,7 +886,6 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
public List<JCExpression> getImplementsClause() {
return implementing;
}
@SuppressWarnings("removal")
@DefinedBy(Api.COMPILER_TREE)
public List<JCExpression> getPermitsClause() {
return permitting;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -151,7 +151,7 @@ public class List<A> extends AbstractCollection<A> implements java.util.List<A>
/** Construct a list consisting of given elements.
*/
@SuppressWarnings({"varargs", "unchecked"})
@SuppressWarnings("unchecked")
public static <A> List<A> of(A x1, A x2, A x3, A... rest) {
return new List<>(x1, new List<>(x2, new List<>(x3, from(rest))));
}

View File

@@ -652,7 +652,6 @@ public class RichDiagnosticFormatter extends
/** set of enabled rich formatter's features */
protected java.util.EnumSet<RichFormatterFeature> features;
@SuppressWarnings("fallthrough")
public RichConfiguration(Options options, AbstractDiagnosticFormatter formatter) {
super(formatter.getConfiguration());
features = formatter.isRaw() ? EnumSet.noneOf(RichFormatterFeature.class) :