Summary
Deprecate the JDI/JDWP capabilities canUnrestrictedlyRedefineClasses and canAddMethod.
Problem
The JDWP/JDI canUnrestrictedlyRedefineClasses and canAddMethod capabilities are not compatible with the JVM TI spec as the JVM TI does not allow unrestricted class redefinition. It is why these capabilities are always false in the reference implementation of the JDI.
Solution
Deprecate these capabilities and make it clear that it returns always false in the reference implementation.
Specification
-
Update the JDWP
VirtualMachine::capabilitiesNewcommand spec:Update the description of capabilities
canUnrestrictedlyRedefineClassesandcanAddMethodin theReplyDatasection of thecapabilitiesNewcommand:- add the deprecation annotation before method declaration:
@Deprecated(since="15") A JVM TI based JDWP back-end will never set this capability to true.
-
Update the java-doc for JDI
Updated the
com.sun.jdi.VirtualMachinespec for methodscanUnrestrictedlyRedefineClassesandcanAddMethod:- add the deprecation annotation before method declaration:
@Deprecated(since="15")
- add a deprecation comment:
@deprecated A JVM TI based JDWP back-end will never set this capability to true.
Webrev:
http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-depr.1/src/
Updated JDWP VirtualMachine::capabilitiesNew spec:
http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-depr.1/docs/specs/jdwp/jdwp-protocol.html#JDWP_VirtualMachine_CapabilitiesNew
Updated JDI com.sun.jdi.VirtualMachine spec:
http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-depr.1/docs/api/jdk.jdi/com/sun/jdi/VirtualMachine.html#canAddMethod()
http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/jdwp-depr.1/docs/api/jdk.jdi/com/sun/jdi/VirtualMachine.html#canUnrestrictedlyRedefineClasses()
- csr of
-
JDK-8196450 Deprecate JDWP/JDI canUnrestrictedlyRedefineClasses to match JVM TI capabilities
-
- Resolved
-