Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8246540

Deprecate JDWP/JDI canUnrestrictedlyRedefineClasses to match JVM TI capabilities

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 15
    • core-svc
    • None
    • behavioral
    • low
    • Hide
      The compatibility risk has to be low.
      There has to be no JVM TI based JDWP back-end that will provide the JDI/JDWP capabilities we are deprecating:
       - canUnrestrictedlyRedefineClasses
       - canAddMethod
      Show
      The compatibility risk has to be low. There has to be no JVM TI based JDWP back-end that will provide the JDI/JDWP capabilities we are deprecating:  - canUnrestrictedlyRedefineClasses  - canAddMethod
    • Java API, File or wire format
    • SE

      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

      1. Update the JDWP VirtualMachine::capabilitiesNew command spec:

        Update the description of capabilities canUnrestrictedlyRedefineClasses and canAddMethod in the ReplyData section of the capabilitiesNew command:

        • add the deprecation annotation before method declaration:

          @Deprecated(since="15") A JVM TI based JDWP back-end will never set this capability to true.

      2. Update the java-doc for JDI

        Updated the com.sun.jdi.VirtualMachine spec for methods canUnrestrictedlyRedefineClasses and 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:

      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()

            sspitsyn Serguei Spitsyn
            sspitsyn Serguei Spitsyn
            David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: