Summary
-------
Remove Java Management Extension (JMX) Subject Delegation which was deprecated for removal in Java 21. The feature is directly dependent on Security Manager APIs that are deprecated for removal. The Subject Delegation feature will cease to be usable once the Security Manager APIs are further degraded and the Security Manager implementation is removed.
Problem
-------
This feature has no known current usage.
This feature does not work without support for the Security Manager APIs which are deprecated for removal (since Java 17, see JEP 411).
Solution
--------
We will remove the feature. There is no replacement. For source and binary compatibility reasons the relevant method is not being removed at this time, but will throw an UnsupportedOperationException when Subject Delegation is attempted.
Specification
-------------
The method `javax.management.remote.JMXConnector.getMBeanServerConnection(Subject delegationSubject)` will throw an UnsupportedOperationException if a non-null delegation subject is provided. This method's documentation will be updated:
```
@param delegationSubject must be null.
@exception UnsupportedOperationException if delegationSubject is non-null.
```
The class `javax.management.remote.rmi.RMIConnection` will document at the class level that:
"JMX Subject Delegation has been removed. All methods that take a delegationSubject parameter will throw UnsupportedOperationException if it is non-null. This parameter is kept for interoperability with older remote clients."
All methods in `RMIConnection` which take a delegationSubject will be updated with:
```
@param delegationSubject must be null.
@throws UnsupportedOperationException if delegationSubject is non-null.
```
The class `javax.management.remote.rmi.RMIConnectionImpl` has methods which accept a Subject parameter for Subject Delegation. This cannot now be non-null in local usage, but an RMI Connection from an older JDK can invoke these methods with a non-null delegationSubject. Such access will be recognised and an UnsupportedOperationException will be thrown.
The attached JMX_SubjectDelegation_Removal_specdiff.zip shows the above in detail (see the files JMXConnector.html, RMIConnector.html, RMIConnection.html, RMIConnectionImpl.html).
PR: https://github.com/openjdk/jdk/pull/18025