JDK 16 RFR of JDK-8250583: Address reliance on default constructors in java.management
Joe Darcy
joe.darcy at oracle.com
Sat Jul 25 17:52:51 UTC 2020
Hello,
I'm not positive serviceability-dev is the best alias for this review;
if not, please direct me elsewhere.
In any case, please review the changes and CSR for:
JDK-8250583: Address reliance on default constructors in
java.management
webrev: http://cr.openjdk.java.net/~darcy/8250583.0/
CSR: https://bugs.openjdk.java.net/browse/JDK-8250584
(This is part of a larger library clean-up effort to remove reliance on
default constructors in the JDK ahead of a new javac lint warning,
JDK-8071961.)
Generally the changes adds a public no-arg constructor equivalent to the
implicit default constructor. In the case of RoleStatus, since it
doesn't seem that the class should have a public constructor at all, I
terminally deprecated the constructor.
Patch below.
Thanks,
-Joe
---
old/src/java.management/share/classes/javax/management/AttributeChangeNotificationFilter.java
2020-07-25 08:53:04.404999999 -0700
+++
new/src/java.management/share/classes/javax/management/AttributeChangeNotificationFilter.java
2020-07-25 08:53:03.720999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 1999, 2020, 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
@@ -50,6 +50,10 @@
*/
private Vector<String> enabledAttributes = new Vector<String>();
+ /**
+ * Constructs an {@code AttributeChangeNotificationFilter}.
+ */
+ public AttributeChangeNotificationFilter() {}
/**
* Invoked before sending the specified notification to the listener.
---
old/src/java.management/share/classes/javax/management/DefaultLoaderRepository.java
2020-07-25 08:53:05.472999999 -0700
+++
new/src/java.management/share/classes/javax/management/DefaultLoaderRepository.java
2020-07-25 08:53:04.812999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 1999, 2020, 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
@@ -51,6 +51,11 @@
@Deprecated
public class DefaultLoaderRepository {
/**
+ * Constructs an {@code DefaultLoaderRepository}.
+ */
+ public DefaultLoaderRepository() {}
+
+ /**
* Go through the list of class loaders and try to load the
requested class.
* The method will stop as soon as the class is found. If the class
* is not found the method will throw a
<CODE>ClassNotFoundException</CODE>
---
old/src/java.management/share/classes/javax/management/NotificationFilterSupport.java
2020-07-25 08:53:06.584999999 -0700
+++
new/src/java.management/share/classes/javax/management/NotificationFilterSupport.java
2020-07-25 08:53:05.876999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 1999, 2020, 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
@@ -69,6 +69,11 @@
/**
+ * Constructs a {@code NotificationFilterSupport}.
+ */
+ public NotificationFilterSupport() {}
+
+ /**
* Invoked before sending the specified notification to the listener.
* <BR>This filter compares the type of the specified notification
with each enabled type.
* If the notification type matches one of the enabled types,
---
old/src/java.management/share/classes/javax/management/QueryEval.java
2020-07-25 08:53:07.704999999 -0700
+++
new/src/java.management/share/classes/javax/management/QueryEval.java
2020-07-25 08:53:07.004999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 1999, 2020, 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,6 +42,11 @@
new InheritableThreadLocal<MBeanServer>();
/**
+ * Constructor for subclasses to call.
+ */
+ public QueryEval() {}
+
+ /**
* <p>Sets the MBean server on which the query is to be performed.
* The setting is valid for the thread performing the set.
* It is copied to any threads created by that thread at the moment
---
old/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java
2020-07-25 08:53:08.824999999 -0700
+++
new/src/java.management/share/classes/javax/management/loading/DefaultLoaderRepository.java
2020-07-25 08:53:08.124999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 2000, 2020, 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
@@ -56,6 +56,11 @@
public class DefaultLoaderRepository {
/**
+ * Constructs a {@code DefaultLoaderRepository}.
+ */
+ public DefaultLoaderRepository() {}
+
+ /**
* Go through the list of class loaders and try to load the requested
* class.
* The method will stop as soon as the class is found. If the class
---
old/src/java.management/share/classes/javax/management/monitor/Monitor.java
2020-07-25 08:53:09.916999999 -0700
+++
new/src/java.management/share/classes/javax/management/monitor/Monitor.java
2020-07-25 08:53:09.244999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 1999, 2020, 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
@@ -76,6 +76,11 @@
extends NotificationBroadcasterSupport
implements MonitorMBean, MBeanRegistration {
+ /**
+ * Constructor for subclasses to call.
+ */
+ public Monitor() {}
+
/*
* ------------------------------------------
* PACKAGE CLASSES
---
old/src/java.management/share/classes/javax/management/relation/RoleStatus.java
2020-07-25 08:53:11.060999999 -0700
+++
new/src/java.management/share/classes/javax/management/relation/RoleStatus.java
2020-07-25 08:53:10.384999999 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights
reserved.
+ * Copyright (c) 2000, 2020, 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,12 @@
*/
public class RoleStatus {
+ /**
+ * Do not call.
+ */
+ @Deprecated(since="16", forRemoval=true)
+ public RoleStatus() {}
+
//
// Possible problems
//
More information about the serviceability-dev
mailing list