RFR: 8165276: Spec states to invoke the premain method in an agent class if it's public but implementation differs

Serguei Spitsyn sspitsyn at openjdk.java.net
Tue Dec 8 20:08:41 UTC 2020


On Tue, 8 Dec 2020 19:51:48 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>>> This change have been already reviewed by Mandy, Sundar, Alan and David.
>>> Now, the PR approval is needed.
>> 
>> Can you provide a link to the discussion? I'm mostly curious if there was some discussion as to why Instrument purposefully allowed non-public premain methods:
>> 
>>          // the premain method should not be required to be public,
>> 508         // make it accessible so we can call it
>> 509         // Note: The spec says the following:
>> 510         //     The agent class must implement a public static premain method...
>> 511         setAccessible(m, true);```
>
> All the discussion is in the bug and CSR:
> https://bugs.openjdk.java.net/browse/JDK-8165276
> https://bugs.openjdk.java.net/browse/JDK-8248189
> We messed up in JDK-5070281 (JDK 6) and it came to light in JDK 9 when auditing the use of setAccessible in the JDK.

Chris, I've added link to the jdk 15 review thread to the PR description.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1694


More information about the serviceability-dev mailing list