src/share/classes/java/lang/invoke/MethodHandles.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
jdk Cdiff src/share/classes/java/lang/invoke/MethodHandles.java
src/share/classes/java/lang/invoke/MethodHandles.java
Print this page
rev 10041 : 8032400: JSR292: invokeSpecial: InternalError attempting to lookup a method
Reviewed-by: psandoz, jrose
*** 1610,1636 ****
// 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.
// FIXME: MemberName.resolve should handle this instead.
! MemberName m2 = new MemberName(refcAsSuper,
method.getName(),
method.getMethodType(),
REF_invokeSpecial);
m2 = IMPL_NAMES.resolveOrNull(refKind, m2, lookupClassOrNull());
if (m2 == null) throw new InternalError(method.toString());
method = m2;
refc = refcAsSuper;
// redo basic checks
checkMethod(refKind, refc, method);
--- 1610,1643 ----
// Optionally check with the security manager; this isn't needed for unreflect* calls.
if (checkSecurity)
checkSecurityManager(refc, method);
assert(!method.isMethodHandleInvoke());
if (refKind == REF_invokeSpecial &&
refc != lookupClass() &&
!refc.isInterface() &&
! refc != 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.
! 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