15 RFR(XS): 8165276: Spec states that invoke the premain method in an agent class if it's public but implementation differs

David Holmes david.holmes at oracle.com
Wed Jun 24 09:24:36 UTC 2020


On 24/06/2020 4:22 pm, Alan Bateman wrote:
> 
> 
> On 24/06/2020 06:50, David Holmes wrote:
>>
>> It sounds like the use of setAccessible was hiding the need to disable 
>> some module related access checks.
>>
>> This will have a much bigger compatibility problem if agents with a 
>> public premain suddenly stop working.
> I'm trying to understand what you mean in the final sentence as there is 
> currently no support for compiling or deploying agents as named modules. 

IIUC the tests do not use named modules. Serguei removed the 
setAccessible code and got an error because the agent code, even though 
public, was not accessible to the class in the java.instrument module. 
So if that test agent represented a real non-modular agent in the field, 
this change would break such agents.

David
-----

> It was prototyped during JDK 9 but hasn't been a priority to come back. 
> If support were to be added then it might require the agent (in its 
> module declare) to export the package with the entry point to 
> java.instrument but this has no impact on the modifiers of the agent 
> class or premain method, they would both required to include "public".
> 
> -Alan.


More information about the serviceability-dev mailing list