8026818: Defmeth failures with -mode invoke
Summary: Added test for IllegalAccessException -> IllegalAccessError path to check if root cause was AbstractMethodError
Reviewed-by: jrose
--- a/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java Tue Oct 22 10:44:22 2013 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java Tue Oct 22 12:57:59 2013 -0400
@@ -441,8 +441,13 @@
assert(refKindIsValid(refKind));
return lookup.linkMethodHandleConstant((byte) refKind, defc, name, type);
} catch (IllegalAccessException ex) {
- Error err = new IllegalAccessError(ex.getMessage());
- throw initCauseFrom(err, ex);
+ Throwable cause = ex.getCause();
+ if (cause instanceof AbstractMethodError) {
+ throw (AbstractMethodError) cause;
+ } else {
+ Error err = new IllegalAccessError(ex.getMessage());
+ throw initCauseFrom(err, ex);
+ }
} catch (NoSuchMethodException ex) {
Error err = new NoSuchMethodError(ex.getMessage());
throw initCauseFrom(err, ex);