On 24/06/2020 10:57, David Holmes wrote:

But you are ignoring my next statement. If we remove the setAccessible(true) then the premain method will not be accessible as Serguei reported.

Exception in thread "main" java.lang.IllegalAccessException: class sun.instrument.InstrumentationImpl   (in module java.instrument) cannot access a member of class SimpleAgent with modifiers "public static"

I feel we are talking past each other on this issue with regards to the IllegalAcessError that comes from the module system.
This is nothing to do with the module system. If you drop the setAccessible(true) from JDK 6 or JDK 8 then you'll also get IllegalAccessException when the member is not accessible.

I think the main thing that needs to be agreed here is whether to fix the bug or change the spec. My view is that fixing the bug should be low risk because (a) I've never seen an agent with a non-public premain method, and (b) Agents typically have to update or release frequently because of updates to the class file version. So yes, it would be a behavioral compatibility issue taht requires CSR approval and requires follow-up release notes to document the change.

-Alan

Reply via email to