src/share/classes/java/lang/invoke/MemberName.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/classes/java/lang/invoke/MemberName.java Fri Jul 11 20:08:49 2014
--- new/src/share/classes/java/lang/invoke/MemberName.java Fri Jul 11 20:08:48 2014
*** 325,338 ****
--- 325,334 ----
private MemberName changeReferenceKind(byte refKind, byte oldKind) {
assert(getReferenceKind() == oldKind);
assert(MethodHandleNatives.refKindIsValid(refKind));
flags += (((int)refKind - oldKind) << MN_REFERENCE_KIND_SHIFT);
// if (isConstructor() && refKind != REF_newInvokeSpecial)
// flags += (IS_METHOD - IS_CONSTRUCTOR);
// else if (refKind == REF_newInvokeSpecial && isMethod())
// flags += (IS_CONSTRUCTOR - IS_METHOD);
return this;
}
private boolean testFlags(int mask, int value) {
return (flags & mask) == value;
*** 342,363 ****
--- 338,368 ----
}
private boolean testAnyFlags(int mask) {
return !testFlags(mask, 0);
}
- /** Utility method to query if this member is a method handle invocation (invoke or invokeExact). */
+ * Also returns true for the non-public MH.invokeBasic.
+ */
public boolean isMethodHandleInvoke() {
! final int bits = MH_INVOKE_MODS &~ Modifier.PUBLIC;
final int negs = Modifier.STATIC;
if (testFlags(bits | negs, bits) &&
clazz == MethodHandle.class) {
return isMethodHandleInvokeName(name);
}
return false;
}
public static boolean isMethodHandleInvokeName(String name) {
return name.equals("invoke") || name.equals("invokeExact");
+ switch (name) {
+ case "invoke":
+ case "invokeExact":
+ case "invokeBasic": // internal sig-poly method
+ return true;
+ default:
+ return false;
+ }
}
private static final int MH_INVOKE_MODS = Modifier.NATIVE | Modifier.FINAL | Modifier.PUBLIC;
/** Utility method to query the modifier flags of this member. */
public boolean isStatic() {
*** 718,737 ****
--- 723,734 ----
*/
public MemberName(Class<?> defClass, String name, Class<?> type, byte refKind) {
init(defClass, name, type, flagsMods(IS_FIELD, 0, refKind));
initResolved(false);
}
! /** Create a field or type name from the given components: Declaring class, name, type.
! * The declaring class may be supplied as null if this is to be a bare name and type.
* The modifier flags default to zero.
* The resulting name will in an unresolved state.
*/
public MemberName(Class<?> defClass, String name, Class<?> type, Void unused) {
this(defClass, name, type, REF_NONE);
initResolved(false);
}
/** Create a method or constructor name from the given components: Declaring class, name, type, modifiers.
! /** Create a method or constructor name from the given components:
! * Declaring class, name, type, reference kind.
* It will be a constructor if and only if the name is {@code "<init>"}.
* The declaring class may be supplied as null if this is to be a bare name and type.
* The last argument is optional, a boolean which requests REF_invokeSpecial.
* The resulting name will in an unresolved state.
*/
src/share/classes/java/lang/invoke/MemberName.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File