8343483: Remove unnecessary @SuppressWarnings annotations (serviceability)

Reviewed-by: cjplummer
This commit is contained in:
Archie Cobbs 2024-11-13 16:58:10 +00:00
parent 7be77725ea
commit a5f11b5f77
16 changed files with 19 additions and 35 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,8 +35,7 @@ import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteRef; import java.rmi.server.RemoteRef;
@SuppressWarnings({"deprecation", @SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
"serial"}) // Externalizable class w/o no-arg c'tor
public class ProxyRef implements RemoteRef { public class ProxyRef implements RemoteRef {
private static final long serialVersionUID = -6503061366316814723L; private static final long serialVersionUID = -6503061366316814723L;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ package javax.management.remote.rmi;
* *
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings({"deprecation", "rawtypes", "unchecked"}) @SuppressWarnings({"deprecation", "rawtypes"})
public final class RMIServerImpl_Stub public final class RMIServerImpl_Stub
extends java.rmi.server.RemoteStub extends java.rmi.server.RemoteStub
implements javax.management.remote.rmi.RMIServer { implements javax.management.remote.rmi.RMIServer {

View File

@ -355,7 +355,6 @@ public class ServerNotifForwarder {
//---------------- //----------------
// PRIVATE METHODS // PRIVATE METHODS
//---------------- //----------------
@SuppressWarnings("removal")
private Subject getSubject() { private Subject getSubject() {
return Subject.current(); return Subject.current();
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -445,7 +445,6 @@ public class FileLoginModule implements LoginModule {
* @param usePasswdFromSharedState a flag to tell this method whether * @param usePasswdFromSharedState a flag to tell this method whether
* to retrieve the password from the sharedState. * to retrieve the password from the sharedState.
*/ */
@SuppressWarnings("unchecked") // sharedState used as Map<String,Object>
private void attemptAuthentication(boolean usePasswdFromSharedState) private void attemptAuthentication(boolean usePasswdFromSharedState)
throws LoginException { throws LoginException {

View File

@ -245,8 +245,7 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent;
* @author Mandy Chung * @author Mandy Chung
* @since 1.5 * @since 1.5
*/ */
@SuppressWarnings({"removal", @SuppressWarnings("doclint:reference") // cross-module links
"doclint:reference"}) // cross-module links
public class ManagementFactory { public class ManagementFactory {
// A class with only static fields and methods. // A class with only static fields and methods.
private ManagementFactory() {}; private ManagementFactory() {};

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2020, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,6 @@ public class BadAttributeValueExpException extends Exception {
* @serial A string representation of the attribute that originated this exception. * @serial A string representation of the attribute that originated this exception.
* For example, the string value can be the return of {@code attribute.toString()}. * For example, the string value can be the return of {@code attribute.toString()}.
*/ */
@SuppressWarnings("serial") // See handling in constructor and readObject
private String val; private String val;
/** /**

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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -162,7 +162,6 @@ public class MonitorNotification extends javax.management.Notification {
/** /**
* @serial Monitor notification observed object. * @serial Monitor notification observed object.
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private ObjectName observedObject = null; private ObjectName observedObject = null;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -61,7 +61,6 @@ public class OpenMBeanAttributeInfoSupport
/** /**
* @serial The open mbean attribute's <i>open type</i> * @serial The open mbean attribute's <i>open type</i>
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private OpenType<?> openType; private OpenType<?> openType;
/** /**
@ -565,7 +564,7 @@ public class OpenMBeanAttributeInfoSupport
} }
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings("unchecked")
static int compare(Object x, Object y) { static int compare(Object x, Object y) {
return ((Comparable) x).compareTo(y); return ((Comparable) x).compareTo(y);
} }
@ -938,7 +937,7 @@ public class OpenMBeanAttributeInfoSupport
return isValue(this, obj); return isValue(this, obj);
} }
@SuppressWarnings({"unchecked", "rawtypes"}) // cast to Comparable @SuppressWarnings("unchecked") // cast to Comparable
static boolean isValue(OpenMBeanParameterInfo info, Object obj) { static boolean isValue(OpenMBeanParameterInfo info, Object obj) {
if (info.hasDefaultValue() && obj == null) if (info.hasDefaultValue() && obj == null)
return true; return true;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -58,7 +58,6 @@ public class OpenMBeanParameterInfoSupport
/** /**
* @serial The open mbean parameter's <i>open type</i> * @serial The open mbean parameter's <i>open type</i>
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private OpenType<?> openType; private OpenType<?> openType;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -612,7 +612,6 @@ public class TabularDataSupport
* @return a collection view ({@code Collection<CompositeData>}) of * @return a collection view ({@code Collection<CompositeData>}) of
* the values contained in this {@code TabularDataSupport} instance. * the values contained in this {@code TabularDataSupport} instance.
*/ */
@SuppressWarnings("unchecked") // historical confusion about the return type
public Collection<Object> values() { public Collection<Object> values() {
return Util.cast(dataMap.values()); return Util.cast(dataMap.values());
@ -648,7 +647,6 @@ public class TabularDataSupport
* of the mappings contained in this map. * of the mappings contained in this map.
* @see java.util.Map.Entry * @see java.util.Map.Entry
*/ */
@SuppressWarnings("unchecked") // historical confusion about the return type
public Set<Map.Entry<Object,Object>> entrySet() { public Set<Map.Entry<Object,Object>> entrySet() {
return Util.cast(dataMap.entrySet()); return Util.cast(dataMap.entrySet());

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -134,7 +134,6 @@ public class RoleList extends ArrayList<Object> {
* *
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public List<Role> asList() { public List<Role> asList() {
if (!typeSafe) { if (!typeSafe) {
if (tainted) if (tainted)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -134,7 +134,6 @@ public class RoleUnresolvedList extends ArrayList<Object> {
* *
* @since 1.6 * @since 1.6
*/ */
@SuppressWarnings("unchecked")
public List<RoleUnresolved> asList() { public List<RoleUnresolved> asList() {
if (!typeSafe) { if (!typeSafe) {
if (tainted) if (tainted)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1999, 2022, 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -1154,7 +1154,6 @@ public class Timer extends NotificationBroadcasterSupport
* *
* @param notification The TimerAlarmClock notification. * @param notification The TimerAlarmClock notification.
*/ */
@SuppressWarnings("deprecation")
void notifyAlarmClock(TimerAlarmClockNotification notification) { void notifyAlarmClock(TimerAlarmClockNotification notification) {
TimerNotification timerNotification = null; TimerNotification timerNotification = null;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -221,7 +221,6 @@ public class TableSorter extends DefaultTableModel implements MouseListener {
return dataVector.elementAt(row); return dataVector.elementAt(row);
} }
@SuppressWarnings("unchecked")
private void setRow(Vector<?> data, int row) { private void setRow(Vector<?> data, int row) {
dataVector.setElementAt(data,row); dataVector.setElementAt(data,row);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,6 @@ public abstract class XTable extends JTable {
public XTable () { public XTable () {
super(); super();
@SuppressWarnings("serial")
final TableSorter sorter = new TableSorter(); final TableSorter sorter = new TableSorter();
setModel(sorter); setModel(sorter);
sorter.addMouseListenerToHeaderInTable(this); sorter.addMouseListenerToHeaderInTable(this);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -376,7 +376,6 @@ class VirtualMachineImpl extends MirrorImpl
} }
Iterator<?> it = classToBytes.entrySet().iterator(); Iterator<?> it = classToBytes.entrySet().iterator();
for (int i = 0; it.hasNext(); i++) { for (int i = 0; it.hasNext(); i++) {
@SuppressWarnings("rawtypes")
Map.Entry<?, ?> entry = (Map.Entry)it.next(); Map.Entry<?, ?> entry = (Map.Entry)it.next();
ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey();
validateMirror(refType); validateMirror(refType);