8232442: Suppress warnings on non-serializable non-transient instance fields in java.management.*

Reviewed-by: rriggs, mchung
This commit is contained in:
Joe Darcy 2019-10-23 13:01:40 -07:00
parent 36ac846d35
commit d8240afe42
24 changed files with 62 additions and 25 deletions

View File

@ -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.RemoteObject;
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;

View File

@ -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 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
*
* @see #RMIConnector(RMIServer,Map)
**/
@SuppressWarnings("serial") // Not statically typed as Serializable
private final RMIServer rmiServer;
/**

View File

@ -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 @@ public class Attribute implements Serializable {
/**
* @serial Attribute value
*/
@SuppressWarnings("serial") // Conditionally serializable
private Object value= null;

View File

@ -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 @@ public class AttributeChangeNotification extends javax.management.Notification {
/**
* @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;

View File

@ -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 @@ 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 Object val;
/**

View File

@ -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 @@ public class ImmutableDescriptor implements Descriptor {
* 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;

View File

@ -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 @@ public class InvalidApplicationException extends Exception {
/**
* @serial The object representing the class of the MBean
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object val;

View File

@ -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 @@ public class NotificationFilterSupport implements NotificationFilter {
* @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>();

View File

@ -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 @@ import java.net.URLStreamHandlerFactory;
*
* @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;

View File

@ -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 @@ public class MonitorNotification extends javax.management.Notification {
/**
* @serial Monitor notification observed object.
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private ObjectName observedObject = null;
/**
@ -172,6 +173,7 @@ public class MonitorNotification extends javax.management.Notification {
/**
* @serial Monitor notification derived gauge.
*/
@SuppressWarnings("serial") // Not statically typed as Serializable
private Object derivedGauge = null;
/**
@ -179,6 +181,7 @@ public class MonitorNotification extends javax.management.Notification {
* 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;

View File

@ -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 @@ public class CompositeDataSupport
* respective values.
* A {@link SortedMap} is used for faster retrieval of elements.
*/
@SuppressWarnings("serial") // Conditionally serializable
private final SortedMap<String, Object> contents;
/**

View File

@ -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 @@ public class OpenMBeanAttributeInfoSupport
/**
* @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;

View File

@ -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 @@ public class OpenMBeanParameterInfoSupport
/**
* @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;

View File

@ -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 @@ public class TabularDataSupport
* @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;
/**

View File

@ -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 @@ public class TabularType extends OpenType<TabularData> {
* @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;

View File

@ -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 @@ import javax.management.openmbean.TabularType;
public abstract class LazyCompositeData
implements CompositeData, Serializable {
@SuppressWarnings("serial") // Not statically typed as Serializable
private CompositeData compositeData;
// Implementation of the CompositeData interface

View File

@ -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 @@ import javax.management.openmbean.OpenDataException;
* 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) {

View File

@ -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 @@ import javax.management.openmbean.OpenDataException;
* 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) {

View File

@ -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 @@ import javax.management.openmbean.OpenDataException;
* 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) {

View File

@ -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 @@ import javax.management.openmbean.OpenType;
* 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) {

View File

@ -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 @@ import javax.management.openmbean.OpenType;
* 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) {

View File

@ -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 @@ import java.nio.*;
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,

View File

@ -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 @@ import java.nio.ReadOnlyBufferException;
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,

View File

@ -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 @@ import java.nio.ReadOnlyBufferException;
public class PerfLongCounter extends AbstractCounter
implements LongCounter {
@SuppressWarnings("serial") // Value indirectly copied as a long[] in writeReplace
LongBuffer lb;
// package private