On Sat, 12 Dec 2020 09:48:27 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Serguei Spitsyn has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   added 8165276 to @bug list of impacted tests
>
> src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java 
> line 468:
> 
>> 466:             String msg = "method " + classname + "." +  methodname + " 
>> must be declared public";
>> 467:             throw new IllegalAccessException(msg);
>> 468:         }
> 
> I think the updated patch looks much better. 
> 
> If the agent class doesn't declare a premain then NoSuchMethodException will 
> be thrown.
> 
> The only thing that I'm wondering about now is the exception message when the 
> agent class is not public. If I read the changes correctly it means that 
> IllegalAccessException will be thrown saying that <class>.premain should be 
> public. Is that correct? We might need to adjust to the exception message to 
> make it clear, or put in an explicit then to ensure to test that the agent 
> class is public.

I think an explicit check for a public premain method is better to disambiguate 
the cases and provide appropriate error messages.

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

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

Reply via email to