Skip to content

Commit

Permalink
8343477: Remove unnecessary @SuppressWarnings annotations (compiler)
Browse files Browse the repository at this point in the history
Reviewed-by: darcy, mcimadamore
  • Loading branch information
archiecobbs committed Dec 16, 2024
1 parent 8133eb2 commit d737978
Show file tree
Hide file tree
Showing 17 changed files with 11 additions and 29 deletions.
4 changes: 2 additions & 2 deletions make/jdk/src/classes/build/tools/depend/Depend.java
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -446,7 +446,7 @@ public Void visitType(TypeElement e, Void p) {
}

@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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -4634,7 +4633,6 @@ private static AnnotationDescription parseAnnotation(String value, int[] valuePo
/**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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,6 @@ private void scanPlatformPath(PackageSymbol p) throws IOException {
EnumSet.of(JavaFileObject.Kind.CLASS)));
}
// where
@SuppressWarnings("fallthrough")
private void fillIn(PackageSymbol p,
Location location,
Iterable<JavaFileObject> files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,6 @@ public List<Type> getPermittedSubclasses() {

/** A class for variable symbols
*/
@SuppressWarnings("preview")
public static class VarSymbol extends Symbol implements VariableElement {

/** The variable's declaration position.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ public List<TypeMetadata> getMetadata() {
/**
* 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);
}
Expand Down Expand Up @@ -2133,7 +2132,6 @@ public final void addBound(InferenceBound ib, Type bound, Types types) {
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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -611,7 +611,6 @@ public void scan() {
}

@Override
@SuppressWarnings("unchecked")
public void scan(JCTree tree) {
if (tree != null) {
for (StatementAnalyzer<JCTree, JCTree> analyzer : analyzers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3282,7 +3282,6 @@ void markDead() {
//do nothing
}

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

@SuppressWarnings("fallthrough")
void letInit(JCTree tree) {
tree = TreeInfo.skipParens(tree);
if (tree.hasTag(IDENT) || tree.hasTag(SELECT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ public UsesProvidesVisitor(ModuleSymbol msym, Env<AttrContext> env) {
this.env = env;
}

@Override @SuppressWarnings("unchecked")
@Override
public void visitModuleDef(JCModuleDecl tree) {
msym.directives = List.nil();
msym.provides = List.nil();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -274,7 +274,6 @@ abstract class OperatorHelper {
/** 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5193,7 +5193,6 @@ DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceCo
* while inapplicable candidates contain further details about the
* reason why the method has been considered inapplicable.
*/
@SuppressWarnings("overrides")
class Candidate {

final MethodResolutionPhase step;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -339,7 +339,6 @@ && isNative(md2)) {
}
}
}
@SuppressWarnings("fallthrough")
protected final String jniType(Type t) {
switch (t.getKind()) {
case ARRAY: {
Expand Down Expand Up @@ -442,7 +441,6 @@ static enum EncoderType {
JNI,
SIGNATURE
}
@SuppressWarnings("fallthrough")
static String encode(CharSequence name, EncoderType mtype) {
StringBuilder result = new StringBuilder(100);
int length = name.length();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -220,7 +220,7 @@ public void visitArray(Attribute.Array a) {
}
}

@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings("unchecked")
public void visitEnum(Attribute.Enum e) {
if (returnClass.isEnum()) {
String constName = e.value.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2834,7 +2834,6 @@ public JCBlock block() {
* LocalVariableDeclarationStatement
* = { FINAL | '@' Annotation } Type VariableDeclarators ";"
*/
@SuppressWarnings("fallthrough")
List<JCStatement> blockStatements() {
//todo: skip to anchor on error(?)
int lastErrPos = -1;
Expand Down Expand Up @@ -2892,7 +2891,6 @@ JCStatement parseStatementAsBlock() {

/**This method parses a statement appearing inside a block.
*/
@SuppressWarnings("fallthrough")
List<JCStatement> blockStatement() {
//todo: skip to anchor on error(?)
Comment dc;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,6 @@ public List<JCTypeParameter> getTypeParameters() {
public List<JCExpression> getImplementsClause() {
return implementing;
}
@SuppressWarnings("removal")
@DefinedBy(Api.COMPILER_TREE)
public List<JCExpression> getPermitsClause() {
return permitting;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -151,7 +151,7 @@ public static <A> List<A> of(A x1, A x2, A x3) {

/** 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))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,6 @@ public static class RichConfiguration extends ForwardingDiagnosticFormatter.Forw
/** 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) :
Expand Down

1 comment on commit d737978

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.