RFR(S) / guidance, 8022701 Accessibility checking: InvocationTargetException is thrown instead of IllegalAccessError

Alan Bateman Alan.Bateman at oracle.com
Fri Sep 6 15:28:56 UTC 2013


On 06/09/2013 15:18, David Chase wrote:
> webrev: http://cr.openjdk.java.net/~drchase/8022701/webrev.00/
>
> bug: The bug report is not correct, but there is nonetheless a related underlying bug where IllegalAccessError fails to be thrown.
>
> Question #1, is this a corelibs bug?  It was filed against compiler, but the fix is in the jdk classes, but it is MethodHandle code.
component=core-libs, subcomonent=java.lang.invoke is probably what you 
are looking for. I think most of the discussion on method handles is on 
mlvm-dev although it pop up here periodically too.

>
> Question #2, what's the best way to write a jtreg test suite that requires incompatible class files, that could not result from a single javac compilation?
Can you coerce ASM into creating it? Alternatively it is something that 
you can create off-line and include in a class as a byte array (to load 
via your own URLClassLoader)?

>
> Question #3, the message(s) attached to the exception are not the same in all cases:
>
> a. IllegalAccessError's been caught java.lang.IllegalAccessError: member is private: MethodSupplier.m()void/invokeVirtual, from MethodInvoker
>
> b. IllegalAccessError's been caught java.lang.IllegalAccessError: tried to access method MethodSupplier.m()V from class MethodInvoker
>
> c. IllegalAccessError's been caught java.lang.IllegalAccessError:
>
> d. IllegalAccessError's been caught java.lang.IllegalAccessError: tried to access method MethodSupplier.m()V from class MethodInvoker
>
> The difference between a. and c. above (and these are the two that change under this fix, the code the execution definitely intersects at the fix) is:
>
> a = Class.forName("MethodInvoker").getMethod("invoke").invoke(null);
> c = MethodInvoker.invoke();
>
> yet one has the message copied from the underlying IllegalAccessException (not IAError) and the other does not.
Do you mean you want the messages to be consistent? (I don't think I 
quite get the question).

-Alan






More information about the core-libs-dev mailing list