8026818: Defmeth failures with -mode invoke

Added test for IllegalAccessException -> IllegalAccessError path to check if root cause was AbstractMethodError

Reviewed-by: jrose
This commit is contained in:
David Chase 2013-10-22 12:57:59 -04:00
parent 7ebab2dbcd
commit 2ebcd75a95

View File

@ -441,8 +441,13 @@ class MethodHandleNatives {
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);