8232442: Suppress warnings on non-serializable non-transient instance fields in java.management.*
Reviewed-by: rriggs, mchung
--- a/src/java.management.rmi/share/classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management.rmi/share/classes/com/sun/jmx/remote/internal/rmi/ProxyRef.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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,7 +35,8 @@
import java.rmi.server.RemoteRef;
-@SuppressWarnings("deprecation")
+@SuppressWarnings({"deprecation",
+ "serial"}) // Externalizable class w/o no-arg c'tor
public class ProxyRef implements RemoteRef {
private static final long serialVersionUID = -6503061366316814723L;
--- a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnector.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -2245,6 +2245,7 @@
*
* @see #RMIConnector(RMIServer,Map)
**/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final RMIServer rmiServer;
/**
--- a/src/java.management/share/classes/javax/management/Attribute.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/Attribute.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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
@@ -49,6 +49,7 @@
/**
* @serial Attribute value
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private Object value= null;
--- a/src/java.management/share/classes/javax/management/AttributeChangeNotification.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/AttributeChangeNotification.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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
@@ -74,11 +74,13 @@
/**
* @serial The MBean attribute old value.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private Object oldValue = null;
/**
* @serial The MBean attribute new value.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private Object newValue = null;
--- a/src/java.management/share/classes/javax/management/BadAttributeValueExpException.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/BadAttributeValueExpException.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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,6 +47,7 @@
* @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 Object val;
/**
--- a/src/java.management/share/classes/javax/management/ImmutableDescriptor.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/ImmutableDescriptor.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -52,6 +52,7 @@
* elements in this array match the corresponding elements in the
* {@code names} array.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final Object[] values;
private transient int hashCode = -1;
--- a/src/java.management/share/classes/javax/management/InvalidApplicationException.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/InvalidApplicationException.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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
@@ -44,6 +44,7 @@
/**
* @serial The object representing the class of the MBean
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object val;
--- a/src/java.management/share/classes/javax/management/NotificationFilterSupport.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/NotificationFilterSupport.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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
@@ -64,6 +64,7 @@
* @serial {@link Vector} that contains the enabled notification types.
* The default value is an empty vector.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private List<String> enabledTypes = new Vector<String>();
--- a/src/java.management/share/classes/javax/management/loading/PrivateMLet.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/loading/PrivateMLet.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, 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
@@ -38,6 +38,7 @@
*
* @since 1.5
*/
+@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
public class PrivateMLet extends MLet implements PrivateClassLoader {
private static final long serialVersionUID = 2503458973393711979L;
--- a/src/java.management/share/classes/javax/management/monitor/MonitorNotification.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/monitor/MonitorNotification.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2019, 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,6 +162,7 @@
/**
* @serial Monitor notification observed object.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private ObjectName observedObject = null;
/**
@@ -172,6 +173,7 @@
/**
* @serial Monitor notification derived gauge.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object derivedGauge = null;
/**
@@ -179,6 +181,7 @@
* This value is used to keep the threshold/string (depending on the
* monitor type) that triggered off this notification.
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object trigger = null;
--- a/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/openmbean/CompositeDataSupport.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -62,6 +62,7 @@
* respective values.
* A {@link SortedMap} is used for faster retrieval of elements.
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final SortedMap<String, Object> contents;
/**
--- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -64,27 +64,32 @@
/**
* @serial The open mbean attribute's <i>open type</i>
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private OpenType<?> openType;
/**
* @serial The open mbean attribute's default value
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final Object defaultValue;
/**
* @serial The open mbean attribute's legal values. This {@link
* Set} is unmodifiable
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final Set<?> legalValues; // to be constructed unmodifiable
/**
* @serial The open mbean attribute's min value
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final Comparable<?> minValue;
/**
* @serial The open mbean attribute's max value
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private final Comparable<?> maxValue;
--- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanParameterInfoSupport.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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,27 +58,32 @@
/**
* @serial The open mbean parameter's <i>open type</i>
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private OpenType<?> openType;
/**
* @serial The open mbean parameter's default value
*/
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private Object defaultValue = null;
/**
* @serial The open mbean parameter's legal values. This {@link
* Set} is unmodifiable
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private Set<?> legalValues = null; // to be constructed unmodifiable
/**
* @serial The open mbean parameter's min value
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private Comparable<?> minValue = null;
/**
* @serial The open mbean parameter's max value
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private Comparable<?> maxValue = null;
--- a/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/openmbean/TabularDataSupport.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -86,6 +86,7 @@
* @serial This tabular data instance's contents: a {@link HashMap}
*/
// field cannot be final because of clone method
+ @SuppressWarnings("serial") // Conditionally serializable
private Map<Object,CompositeData> dataMap;
/**
--- a/src/java.management/share/classes/javax/management/openmbean/TabularType.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/javax/management/openmbean/TabularType.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2019, 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
@@ -59,6 +59,7 @@
* @serial The items used to index each row element, kept in the order the user gave
* This is an unmodifiable {@link ArrayList}
*/
+ @SuppressWarnings("serial") // Conditionally serializable
private List<String> indexNames;
--- a/src/java.management/share/classes/sun/management/LazyCompositeData.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/LazyCompositeData.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -46,6 +46,7 @@
public abstract class LazyCompositeData
implements CompositeData, Serializable {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private CompositeData compositeData;
// Implementation of the CompositeData interface
--- a/src/java.management/share/classes/sun/management/LockInfoCompositeData.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/LockInfoCompositeData.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2019, 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
@@ -38,6 +38,7 @@
* construction of a CompositeData use in the local case.
*/
public class LockInfoCompositeData extends LazyCompositeData {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final LockInfo lock;
private LockInfoCompositeData(LockInfo li) {
--- a/src/java.management/share/classes/sun/management/MemoryNotifInfoCompositeData.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/MemoryNotifInfoCompositeData.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -38,6 +38,7 @@
* construction of a CompositeData use in the local case.
*/
public class MemoryNotifInfoCompositeData extends LazyCompositeData {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final MemoryNotificationInfo memoryNotifInfo;
private MemoryNotifInfoCompositeData(MemoryNotificationInfo info) {
--- a/src/java.management/share/classes/sun/management/MemoryUsageCompositeData.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/MemoryUsageCompositeData.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -37,6 +37,7 @@
* construction of a CompositeData use in the local case.
*/
public class MemoryUsageCompositeData extends LazyCompositeData {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final MemoryUsage usage;
private MemoryUsageCompositeData(MemoryUsage u) {
--- a/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/MonitorInfoCompositeData.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2019, 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
@@ -40,6 +40,7 @@
* construction of a CompositeData use in the local case.
*/
public class MonitorInfoCompositeData extends LazyCompositeData {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final MonitorInfo lock;
private MonitorInfoCompositeData(MonitorInfo mi) {
--- a/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/ThreadInfoCompositeData.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -45,7 +45,9 @@
* construction of a CompositeData use in the local case.
*/
public class ThreadInfoCompositeData extends LazyCompositeData {
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final ThreadInfo threadInfo;
+ @SuppressWarnings("serial") // Not statically typed as Serializable
private final CompositeData cdata;
private ThreadInfoCompositeData(ThreadInfo ti) {
--- a/src/java.management/share/classes/sun/management/counter/perf/PerfByteArrayCounter.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/counter/perf/PerfByteArrayCounter.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -31,6 +31,7 @@
public class PerfByteArrayCounter extends AbstractCounter
implements ByteArrayCounter {
+ @SuppressWarnings("serial") // Value indirectly copied as a byte[] in writeReplace
ByteBuffer bb;
PerfByteArrayCounter(String name, Units u, Variability v,
--- a/src/java.management/share/classes/sun/management/counter/perf/PerfLongArrayCounter.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/counter/perf/PerfLongArrayCounter.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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
@@ -33,6 +33,8 @@
public class PerfLongArrayCounter extends AbstractCounter
implements LongArrayCounter {
+
+ @SuppressWarnings("serial") // Value indirectly copied as a long[] in writeReplace
LongBuffer lb;
PerfLongArrayCounter(String name, Units u, Variability v,
--- a/src/java.management/share/classes/sun/management/counter/perf/PerfLongCounter.java Wed Oct 23 18:34:25 2019 +0200
+++ b/src/java.management/share/classes/sun/management/counter/perf/PerfLongCounter.java Wed Oct 23 13:01:40 2019 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, 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,6 +32,7 @@
public class PerfLongCounter extends AbstractCounter
implements LongCounter {
+ @SuppressWarnings("serial") // Value indirectly copied as a long[] in writeReplace
LongBuffer lb;
// package private