8026818: Defmeth failures with -mode invoke
authordrchase
Tue, 22 Oct 2013 12:57:59 -0400
changeset 21326 6abd31ba3aba
parent 21325 8ccf86fcccda
child 21327 9fc34e0b2a47
8026818: Defmeth failures with -mode invoke Summary: Added test for IllegalAccessException -> IllegalAccessError path to check if root cause was AbstractMethodError Reviewed-by: jrose
jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java
--- 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);