15 RFR(XS): 8165276: Spec states that invoke the premain method in an agent class if it's public but implementation differs
    Mandy Chung 
    mandy.chung at oracle.com
       
    Wed Jun 24 19:44:06 UTC 2020
    
    
  
On 6/24/20 12:26 PM, serguei.spitsyn at oracle.com wrote:
> On 6/24/20 05:25, David Holmes wrote:
>>
>> Ah! The test class SimpleAgent is what is not public. That seems a 
>> bug in the test.
>
> There are many such tests.
> We can break some of the existing agents by rejecting non-public agent 
> classes.
> I'm inclined to continue using the setAccessible and just add an extra 
> check for non-public premain/agentmain methods.
There is only one non-public SimpleAgent which is shared by 
j.l.instrument tests.
   test/jdk/java/lang/instrument/SimpleAgent.java
test/hotspot/jtreg/runtime/cds/appcds/jvmti/dumpingWithAgent implements 
the agent properly (a public class and a public static void premain method).
As the popular Java agents are conforming the spec (publicly accessible 
premain method), the compatibility risk is low.
Unless such a  java agent exists and finds a strong compelling reason to 
argue that its premain method must be allowed non-public, I do not see 
the argument to change the spec to allow non-public agent classes.
A bad test case is not a representative existing java agent.
Mandy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20200624/f6b3e5b9/attachment.htm>
    
    
More information about the serviceability-dev
mailing list