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:57:56 UTC 2020


On 24/06/2020 7:43 pm, Alan Bateman wrote:
> On 24/06/2020 10:26, David Holmes wrote:
>>
>>
>> If we call setAccessible(true) then canAccess will return true.
> Sure but the bug fix will remove the setAccessible(true) so canAccess 
> will do what he wants without needing to catch the exception. This is of 
> course all a side show to the important issue of aligning the spec and 
> implementation.

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.

David
-----

> -Alan


More information about the serviceability-dev mailing list