On 6/24/20 12:26 PM, serguei.spit...@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

Reply via email to