On 24/06/2020 5:33 pm, Alan Bateman wrote:
On 24/06/2020 07:55, serguei.spit...@oracle.com wrote:
Thank you for the example.
Yes, I'm working on a helpful message and was thinking to use the
Reflection method:
IllegalAccessException newIllegalAccessException(Class<?> currentClass,
Class<?> memberClass,
Class<?> targetClass,
int modifiers);
m.canAccess(null) will tell you if the premain method is accessible. If
it returns false then you can thrwo IAE with a useful message.
If we call setAccessible(true) then canAccess will return true.
If we don't call setAccessible(true) then canAccess will return false
due to the problem Serguei reported.
David
-Alan.