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 - canUnrestrictedlyRedefineClassesand- canAddMethodin the- ReplyDatasection of the- capabilitiesNewcommand:- add the deprecation annotation before method declaration:
@Deprecated(since="15") A JVM TI based JDWP back-end will never set this capability to true. 
 
- add the deprecation annotation before method declaration:
- Update the java-doc for JDI - Updated the - com.sun.jdi.VirtualMachinespec for methods- canUnrestrictedlyRedefineClassesand- canAddMethod:- 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:
Updated JDI com.sun.jdi.VirtualMachine spec:
- csr of
- 
                    JDK-8196450 Deprecate JDWP/JDI canUnrestrictedlyRedefineClasses to match JVM TI capabilities -           
- Resolved
 
-