From 69ec45348a89eb93794f04cf0d5a61377b90f156 Mon Sep 17 00:00:00 2001 From: Kevin Walls Date: Wed, 29 Jan 2025 08:42:06 +0000 Subject: [PATCH] 8347985: Deprecate java.management Permission classes for removal Reviewed-by: sspitsyn, rriggs --- .../java/lang/management/ManagementPermission.java | 8 ++++++-- .../share/classes/javax/management/MBeanPermission.java | 7 ++++++- .../classes/javax/management/MBeanServerPermission.java | 8 +++++++- .../classes/javax/management/MBeanTrustPermission.java | 7 ++++++- .../management/remote/SubjectDelegationPermission.java | 7 ++++++- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/java.management/share/classes/java/lang/management/ManagementPermission.java b/src/java.management/share/classes/java/lang/management/ManagementPermission.java index 2dbee65e5cb..7c9958d72cb 100644 --- a/src/java.management/share/classes/java/lang/management/ManagementPermission.java +++ b/src/java.management/share/classes/java/lang/management/ManagementPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ package java.lang.management; * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. * * @author Mandy Chung * @since 1.5 @@ -41,8 +42,11 @@ package java.lang.management; * @see java.security.PermissionCollection * @see java.lang.SecurityManager * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. + * */ - +@Deprecated(since="25", forRemoval=true) public final class ManagementPermission extends java.security.BasicPermission { private static final long serialVersionUID = 1897496590799378737L; diff --git a/src/java.management/share/classes/javax/management/MBeanPermission.java b/src/java.management/share/classes/javax/management/MBeanPermission.java index 46717846cb3..abc3cdda7a8 100644 --- a/src/java.management/share/classes/javax/management/MBeanPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -161,9 +161,14 @@ import java.security.Permission; * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public class MBeanPermission extends Permission { private static final long serialVersionUID = -2416928705275160661L; diff --git a/src/java.management/share/classes/javax/management/MBeanServerPermission.java b/src/java.management/share/classes/javax/management/MBeanServerPermission.java index dc77d605912..c59c3e5ec35 100644 --- a/src/java.management/share/classes/javax/management/MBeanServerPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanServerPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -67,9 +67,14 @@ import java.util.StringTokenizer; * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public class MBeanServerPermission extends BasicPermission { private static final long serialVersionUID = -5661980843569388590L; @@ -334,6 +339,7 @@ public class MBeanServerPermission extends BasicPermission { * implementation from defining a PermissionCollection there with an * optimized "implies" method. */ +@SuppressWarnings("removal") class MBeanServerPermissionCollection extends PermissionCollection { /** @serial Null if no permissions in collection, otherwise a single permission that is the union of all permissions that diff --git a/src/java.management/share/classes/javax/management/MBeanTrustPermission.java b/src/java.management/share/classes/javax/management/MBeanTrustPermission.java index d961fe47193..2929b5c6097 100644 --- a/src/java.management/share/classes/javax/management/MBeanTrustPermission.java +++ b/src/java.management/share/classes/javax/management/MBeanTrustPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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,9 +44,14 @@ import java.io.ObjectInputStream; * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public class MBeanTrustPermission extends BasicPermission { private static final long serialVersionUID = -2952178077029018140L; diff --git a/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java b/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java index e2346e92bd5..9c5f4f05927 100644 --- a/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java +++ b/src/java.management/share/classes/javax/management/remote/SubjectDelegationPermission.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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,9 +56,14 @@ import java.security.BasicPermission; * @apiNote * This permission cannot be used for controlling access to resources * as the Security Manager is no longer supported. + * Consequently this class is deprecated for removal in a future release. + * + * @deprecated This class was only useful in conjunction with the Security Manager, + * which is no longer supported. There is no replacement for this class. * * @since 1.5 */ +@Deprecated(since="25", forRemoval=true) public final class SubjectDelegationPermission extends BasicPermission { private static final long serialVersionUID = 1481618113008682343L;