src/share/classes/java/lang/invoke/MethodHandles.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/classes/java/lang/invoke/MethodHandles.java Fri Jun 6 02:21:40 2014
--- new/src/share/classes/java/lang/invoke/MethodHandles.java Fri Jun 6 02:21:40 2014
*** 1610,1636 ****
--- 1610,1643 ----
// Optionally check with the security manager; this isn't needed for unreflect* calls.
if (checkSecurity)
checkSecurityManager(refc, method);
assert(!method.isMethodHandleInvoke());
Class<?> refcAsSuper;
if (refKind == REF_invokeSpecial &&
refc != lookupClass() &&
!refc.isInterface() &&
! refc != (refcAsSuper = lookupClass().getSuperclass()) &&
refc.isAssignableFrom(lookupClass())) {
assert(!method.getName().equals("<init>")); // not this code path
// Per JVMS 6.5, desc. of invokespecial instruction:
// If the method is in a superclass of the LC,
// and if our original search was above LC.super,
- // repeat the search (symbolic lookup) from LC.super.
+ // and continue with the direct superclass of that class,
+ // and so forth, until a match is found or no further superclasses exist.
// FIXME: MemberName.resolve should handle this instead.
MemberName m2 = new MemberName(refcAsSuper,
+ Class<?> refcAsSuper = lookupClass();
+ MemberName m2;
+ do {
+ refcAsSuper = refcAsSuper.getSuperclass();
+ m2 = new MemberName(refcAsSuper,
method.getName(),
method.getMethodType(),
REF_invokeSpecial);
m2 = IMPL_NAMES.resolveOrNull(refKind, m2, lookupClassOrNull());
+ } while (m2 == null && // no method is found yet
+ refc != refcAsSuper); // search up to refc
if (m2 == null) throw new InternalError(method.toString());
method = m2;
refc = refcAsSuper;
// redo basic checks
checkMethod(refKind, refc, method);
src/share/classes/java/lang/invoke/MethodHandles.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File