Summary
Remove duplication in Instrumentation, JDI and JDWP class redefinition and retransformation specs.
Problem
The same class redefinition/retransformation change restrictions are listed the specs of JVM TI, Instrumentation, JDI and JDWP. There are two problems with it. One is that some extra attention is needed to keep these spec in sync. Another that all specs have to be updated whenever a new class file attribute is introduced and we want to disallow its change in class redefinition and retransformation.
Solution
The solution is to remove this duplication by referencing the JVM TI RedefineClasses and RetransformClasses specs by the Instrumentation, JDI and JDWP specs instead of listing the same limitations.
Specification
Instrumentation spec change
Replace:
The retransformation may change method bodies, the constant pool and attributes (unless explicitly prohibited). The retransformation must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. The retransformation must not change the NestHost, NestMembers, or Record attributes. These restrictions may be lifted in future versions.
With:
The supported class file changes are described in JVM TI RetransformClasses.
Replace:
The redefinition may change method bodies, the constant pool and attributes (unless explicitly prohibited). The redefinition must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. The redefinition must not change the NestHost, NestMembers, or Record attributes. These restrictions may be lifted in future versions.
With:
The supported class file changes are described in JVM TI RedefineClasses.
JDI spec change Replace:
If canUnrestrictedlyRedefineClasses() is false, attempting any of the following will throw this exception: - changing the schema (the fields) - changing the hierarchy (superclasses, interfaces) - deleting a method - changing class modifiers - changing method modifiers - changing the NestHost, NestMembers, or Record class attributes
With:
If canUnrestrictedlyRedefineClasses() is false attempting any of the unsupported class file changes described in JVM TI RedefineClasses will throw this exception.
JDWP spec change
Replace:
Unless the canUnrestrictedlyRedefineClasses capability is present the following redefinitions are restricted:
- changing the schema (the fields)
- changing the hierarchy (superclasses, interfaces)
- deleting a method
- changing class modifiers
- changing method modifiers
- changing the NestHost, NestMembers, or Record class attributes
With:
Unless the canUnrestrictedlyRedefineClasses capability is present the redefinition must follow the restrictions described in JVM TI RedefineClasses."
The webrev is: http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/redef-spec-dedup.1/src/
The updated specs are (JVM TI spec is not changed):
http://cr.openjdk.java.net/~sspitsyn/webrevs/2020/redef-spec-dedup.1/docs :
- csr of
-
JDK-8245392 Remove duplication in class redefinition and retransformation specs
-
- Resolved
-