On 5/16/19 00:22, [email protected] wrote:
Hi Alan,

Thank you for looking at this CSR.


On 5/15/19 00:27, Alan Bateman wrote:
On 14/05/2019 21:20, [email protected] wrote:
:

Summary:

 The spec of the "can_redefine_any_class" needs to be more clear and consistent.
 The suggestion is to change the "can_redefine_any_class" capability spec
  from:

    "Can modify (retransform or redefine) any modifiable class. See IsModifiableClass."

  to:
    "Can redefine any modifiable class. See IsModifiableClass.
     (can_redefine_classes must also be set)"

Can you summarize how this capability is used? At some point we may have modules that cannot be redefined so IsModifableClass has to return false (via its parameter) for classes in that module. The wording for the capability in that function seems to conflict.

Not sure, if I understand you correctly because there can be a confusion here.

Is it about the IsModifiableModule? :
 https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#IsModifiableModule

If so, then it tells if a module can be updated with AddModule{Reads|Exports|Opens|Uses|Provides}.

But, most likely, you are talking about modules which classes can be made not redefined in the future.
Correction.
I wanted to say: "non-modifiable" in the future.

Thanks,
Serguei


> Can you summarize how this capability is used

The potential capability can_redefine_any_class is always set to true in our implementation.
It can be possessed but is never checked.
In most cases, the capabilities are checked in the auto-generated jvmtiEnter.cpp.
For instance, there is a check of can_redefine_classes capability in the RedefineClasses wrapper.

If we introduce some modules which classes can not be redefined then the potential
can_redefine_any_class capability should return false in a case such classes exist.

Please, let me know if you have more questions.


Side notes

Note #1

Then we could consider to introduce new JVMTI function, something like: AreModuleClassesModifiable().
In current implementation IsModifableClass returns false for primitive,
array and unsafe anonymous classes (must be invisible).


Note #2

Just realized there is an incorrectness in current spec of this capability an_redefine_any_class.

This section
https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#jvmtiCapabilities.can_redefine_any_class

tells:
 "Can modify (retransform or redefine) any modifiable class."

It is just wrong. Instead, it should tell:
 "Can modify (retransform or redefine) any class except primitive, array,
  and some implementation defined classes."

In another place it is defined as:
 "If possessed then all classes (except primitive, array, and some implementation
  defined classes) are modifiable (redefine or retransform). "

For reference, see the section "Optional Features" here:
  https://docs.oracle.com/en/java/javase/11/docs/specs/jvmti.html#IsModifiableClass

I'll update the CSR to fix this issue.

Thanks,
Serguei


-Alan



Reply via email to