From a5f11b5f775be6c1d9593562ba65912261efdf52 Mon Sep 17 00:00:00 2001 From: Archie Cobbs Date: Wed, 13 Nov 2024 16:58:10 +0000 Subject: [PATCH] 8343483: Remove unnecessary @SuppressWarnings annotations (serviceability) Reviewed-by: cjplummer --- .../classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java | 5 ++--- .../javax/management/remote/rmi/RMIServerImpl_Stub.java | 4 ++-- .../com/sun/jmx/remote/internal/ServerNotifForwarder.java | 1 - .../com/sun/jmx/remote/security/FileLoginModule.java | 3 +-- .../classes/java/lang/management/ManagementFactory.java | 3 +-- .../javax/management/BadAttributeValueExpException.java | 3 +-- .../javax/management/monitor/MonitorNotification.java | 3 +-- .../openmbean/OpenMBeanAttributeInfoSupport.java | 7 +++---- .../openmbean/OpenMBeanParameterInfoSupport.java | 3 +-- .../javax/management/openmbean/TabularDataSupport.java | 4 +--- .../share/classes/javax/management/relation/RoleList.java | 3 +-- .../javax/management/relation/RoleUnresolvedList.java | 3 +-- .../share/classes/javax/management/timer/Timer.java | 3 +-- .../classes/sun/tools/jconsole/inspector/TableSorter.java | 3 +-- .../share/classes/sun/tools/jconsole/inspector/XTable.java | 3 +-- .../classes/com/sun/tools/jdi/VirtualMachineImpl.java | 3 +-- 16 files changed, 19 insertions(+), 35 deletions(-) diff --git a/src/java.management.rmi/share/classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java b/src/java.management.rmi/share/classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java index 8dd0932020b..c3e4a5c5ff0 100644 --- a/src/java.management.rmi/share/classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java +++ b/src/java.management.rmi/share/classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java @@ -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. * * 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; -@SuppressWarnings({"deprecation", - "serial"}) // Externalizable class w/o no-arg c'tor +@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor public class ProxyRef implements RemoteRef { private static final long serialVersionUID = -6503061366316814723L; diff --git a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIServerImpl_Stub.java b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIServerImpl_Stub.java index a22b374fe2b..708350587c3 100644 --- a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIServerImpl_Stub.java +++ b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIServerImpl_Stub.java @@ -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. * * 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 */ -@SuppressWarnings({"deprecation", "rawtypes", "unchecked"}) +@SuppressWarnings({"deprecation", "rawtypes"}) public final class RMIServerImpl_Stub extends java.rmi.server.RemoteStub implements javax.management.remote.rmi.RMIServer { diff --git a/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java b/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java index fb24055cc8f..dd557523e65 100644 --- a/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java +++ b/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java @@ -355,7 +355,6 @@ public class ServerNotifForwarder { //---------------- // PRIVATE METHODS //---------------- - @SuppressWarnings("removal") private Subject getSubject() { return Subject.current(); } diff --git a/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java b/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java index 77e7eab041b..bb5d5e88ff3 100644 --- a/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java +++ b/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java @@ -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. * * 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 * to retrieve the password from the sharedState. */ - @SuppressWarnings("unchecked") // sharedState used as Map private void attemptAuthentication(boolean usePasswdFromSharedState) throws LoginException { diff --git a/src/java.management/share/classes/java/lang/management/ManagementFactory.java b/src/java.management/share/classes/java/lang/management/ManagementFactory.java index bced7d861f2..03bbcead194 100644 --- a/src/java.management/share/classes/java/lang/management/ManagementFactory.java +++ b/src/java.management/share/classes/java/lang/management/ManagementFactory.java @@ -245,8 +245,7 @@ import sun.management.spi.PlatformMBeanProvider.PlatformComponent; * @author Mandy Chung * @since 1.5 */ -@SuppressWarnings({"removal", - "doclint:reference"}) // cross-module links +@SuppressWarnings("doclint:reference") // cross-module links public class ManagementFactory { // A class with only static fields and methods. private ManagementFactory() {}; diff --git a/src/java.management/share/classes/javax/management/BadAttributeValueExpException.java b/src/java.management/share/classes/javax/management/BadAttributeValueExpException.java index 62904495c6d..4ed9b6a33b7 100644 --- a/src/java.management/share/classes/javax/management/BadAttributeValueExpException.java +++ b/src/java.management/share/classes/javax/management/BadAttributeValueExpException.java @@ -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. * * 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. * For example, the string value can be the return of {@code attribute.toString()}. */ - @SuppressWarnings("serial") // See handling in constructor and readObject private String val; /** diff --git a/src/java.management/share/classes/javax/management/monitor/MonitorNotification.java b/src/java.management/share/classes/javax/management/monitor/MonitorNotification.java index 614fc4d64ee..c02e7c54ade 100644 --- a/src/java.management/share/classes/javax/management/monitor/MonitorNotification.java +++ b/src/java.management/share/classes/javax/management/monitor/MonitorNotification.java @@ -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 @@ -162,7 +162,6 @@ public class MonitorNotification extends javax.management.Notification { /** * @serial Monitor notification observed object. */ - @SuppressWarnings("serial") // Not statically typed as Serializable private ObjectName observedObject = null; /** diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java index 4597f0cca89..c8a6ca2f07a 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java @@ -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. * * 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 open type */ - @SuppressWarnings("serial") // Not statically typed as Serializable private OpenType openType; /** @@ -565,7 +564,7 @@ public class OpenMBeanAttributeInfoSupport } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") static int compare(Object x, Object y) { return ((Comparable) x).compareTo(y); } @@ -938,7 +937,7 @@ public class OpenMBeanAttributeInfoSupport return isValue(this, obj); } - @SuppressWarnings({"unchecked", "rawtypes"}) // cast to Comparable + @SuppressWarnings("unchecked") // cast to Comparable static boolean isValue(OpenMBeanParameterInfo info, Object obj) { if (info.hasDefaultValue() && obj == null) return true; diff --git a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java index 454f089650d..8def9d38cc5 100644 --- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java @@ -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. * * 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 open type */ - @SuppressWarnings("serial") // Not statically typed as Serializable private OpenType openType; /** diff --git a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java index 44f41a1a629..00f255f394b 100644 --- a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java +++ b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java @@ -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. * * 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}) of * the values contained in this {@code TabularDataSupport} instance. */ - @SuppressWarnings("unchecked") // historical confusion about the return type public Collection values() { return Util.cast(dataMap.values()); @@ -648,7 +647,6 @@ public class TabularDataSupport * of the mappings contained in this map. * @see java.util.Map.Entry */ - @SuppressWarnings("unchecked") // historical confusion about the return type public Set> entrySet() { return Util.cast(dataMap.entrySet()); diff --git a/src/java.management/share/classes/javax/management/relation/RoleList.java b/src/java.management/share/classes/javax/management/relation/RoleList.java index 7477634177c..fbbc3df6436 100644 --- a/src/java.management/share/classes/javax/management/relation/RoleList.java +++ b/src/java.management/share/classes/javax/management/relation/RoleList.java @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -134,7 +134,6 @@ public class RoleList extends ArrayList { * * @since 1.6 */ - @SuppressWarnings("unchecked") public List asList() { if (!typeSafe) { if (tainted) diff --git a/src/java.management/share/classes/javax/management/relation/RoleUnresolvedList.java b/src/java.management/share/classes/javax/management/relation/RoleUnresolvedList.java index c69d318776c..dae506e5e5f 100644 --- a/src/java.management/share/classes/javax/management/relation/RoleUnresolvedList.java +++ b/src/java.management/share/classes/javax/management/relation/RoleUnresolvedList.java @@ -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. * * This code is free software; you can redistribute it and/or modify it @@ -134,7 +134,6 @@ public class RoleUnresolvedList extends ArrayList { * * @since 1.6 */ - @SuppressWarnings("unchecked") public List asList() { if (!typeSafe) { if (tainted) diff --git a/src/java.management/share/classes/javax/management/timer/Timer.java b/src/java.management/share/classes/javax/management/timer/Timer.java index 71bdbd0f7da..24054b8baac 100644 --- a/src/java.management/share/classes/javax/management/timer/Timer.java +++ b/src/java.management/share/classes/javax/management/timer/Timer.java @@ -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. * * 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. */ - @SuppressWarnings("deprecation") void notifyAlarmClock(TimerAlarmClockNotification notification) { TimerNotification timerNotification = null; diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/TableSorter.java b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/TableSorter.java index 49b97cad21b..ad142e9c572 100644 --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/TableSorter.java +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/TableSorter.java @@ -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. * * 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); } - @SuppressWarnings("unchecked") private void setRow(Vector data, int row) { dataVector.setElementAt(data,row); } diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTable.java b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTable.java index a18e84f3ca3..9ee1fad0e8b 100644 --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTable.java +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTable.java @@ -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. * * 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 () { super(); - @SuppressWarnings("serial") final TableSorter sorter = new TableSorter(); setModel(sorter); sorter.addMouseListenerToHeaderInTable(this); diff --git a/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java index e35280eb0e8..fa051eae278 100644 --- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java +++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java @@ -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. * * 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(); for (int i = 0; it.hasNext(); i++) { - @SuppressWarnings("rawtypes") Map.Entry entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType);