MemberName
is a compact symbolic datum which fully characterizes
a method or field reference.
A member name refers to a field, method, constructor, or member type.
Every member name has a simple name (a string) and a type (either a Class or MethodType).
A member name may also have a non-null declaring class, or it may be simply
a naked name/type pair.
A member name may also have non-zero modifier flags.
Finally, a member name may be either resolved or unresolved.
If it is resolved, the existence of the named member has been determined by the JVM.
Whether resolved or not, a member name provides no access rights or invocation capability to its possessor. It is merely a compact representation of all symbolic information necessary to link to and properly use the named member.
When resolved, a member name's internal implementation may include references to JVM metadata. This representation is stateless and only descriptive. It provides no private information and no capability to use the member.
By contrast, a java.lang.reflect.Method contains fuller information about the internals of a method (except its bytecodes) and also allows invocation. A MemberName is much lighter than a Method, since it contains about 7 fields to the 16 of Method (plus its sub-arrays), and those seven fields omit much of the information in Method.
Modifier and Type | Class and Description |
---|---|
pack-priv static class | MemberName.
A factory type for resolving member names with the help of the VM. |
Modifier and Type | Field and Description |
---|---|
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
private Class | |
pack-priv static final String | |
pack-priv static final int | |
private int | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
pack-priv static final int | |
private ResolvedMethodName | |
private static final int | |
private String | |
pack-priv static final int | |
pack-priv Object | |
pack-priv static final int | |
pack-priv static final int | |
private Object | |
pack-priv static final int |
Access | Constructor and Description |
---|---|
public | |
public | |
public | |
public | |
public | |
public | |
pack-priv | |
public | MemberName(Class<?> defClass, String name, Class<?> type, byte refKind)
Create a field or type name from the given components: Declaring class, name, type, reference kind. |
public | MemberName(Class<?> defClass, String name, MethodType type, byte refKind)
Create a method or constructor name from the given components: Declaring class, name, type, reference kind. |
public | MemberName(byte refKind, Class<?> defClass, String name, Object type)
Create a method, constructor, or field name from the given components: Reference kind, declaring class, name, type. |
Modifier and Type | Method and Description |
---|---|
private boolean | |
private boolean | |
public MemberName | |
public MemberName | asNormalOriginal()
If this MN is a REF_invokeSpecial, return a clone with the "normal" kind REF_invokeVirtual; also switch either to REF_invokeInterface if clazz.isInterface. |
public MemberName | |
public boolean | |
private MemberName | |
protected MemberName | |
pack-priv void | |
public boolean | equals(Object
the reference object with which to compare. that)Overrides java. Indicates whether some other object is "equal to" this one. |
public boolean | |
private void | |
private static int | |
public ClassLoader | |
public Class | getDeclaringClass()
Implements java. Return the declaring class of this member. |
public MemberName | |
pack-priv static MemberName. | |
public Class | |
public MethodType | |
pack-priv String | |
public MethodType | |
public MethodType | |
public int | getModifiers()
Implements java. Return the modifier flags of this member. |
public String | |
private static String | |
public byte | |
public Object | |
public int | |
private void | |
pack-priv void | |
public boolean | |
public boolean | isBridge()
Utility method to query the modifier flags of this member; returns false if the member is not a method. |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | isMethodHandleInvoke()
Utility method to query if this member is a method handle invocation (invoke or invokeExact). |
public static boolean | |
public boolean | |
private boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | |
public boolean | isSynthetic()
Implements java. Utility method to query the modifier flags of this member; returns false if the member is not a method. |
public boolean | |
public boolean | |
public boolean | isVarargs()
Utility method to query the modifier flags of this member; returns false if the member is not a method. |
public boolean | |
public static boolean | |
public boolean | |
public IllegalAccessException | |
public ReflectiveOperationException | |
pack-priv static MemberName | makeMethodHandleInvoke(String name, MethodType type)
Create a name for a signature-polymorphic invoker. |
pack-priv static MemberName | |
pack-priv static MemberName | |
pack-priv static MemberName | |
private boolean | |
private String | |
private boolean | |
pack-priv boolean | |
public boolean | |
private boolean | |
public String | |
private boolean |
ALL_ACCESS | back to summary |
---|---|
pack-priv static final int ALL_ACCESS |
ALL_KINDS | back to summary |
---|---|
pack-priv static final int ALL_KINDS |
ANNOTATION | back to summary |
---|---|
pack-priv static final int ANNOTATION |
BRIDGE | back to summary |
---|---|
pack-priv static final int BRIDGE |
CALLER_SENSITIVE | back to summary |
---|---|
pack-priv static final int CALLER_SENSITIVE |
clazz | back to summary |
---|---|
private Class<?> clazz |
CONSTRUCTOR_NAME | back to summary |
---|---|
pack-priv static final String CONSTRUCTOR_NAME |
ENUM | back to summary |
---|---|
pack-priv static final int ENUM |
flags | back to summary |
---|---|
private int flags |
IS_CONSTRUCTOR | back to summary |
---|---|
pack-priv static final int IS_CONSTRUCTOR |
IS_FIELD | back to summary |
---|---|
pack-priv static final int IS_FIELD |
IS_INVOCABLE | back to summary |
---|---|
pack-priv static final int IS_INVOCABLE |
IS_METHOD | back to summary |
---|---|
pack-priv static final int IS_METHOD |
IS_TYPE | back to summary |
---|---|
pack-priv static final int IS_TYPE |
method | back to summary |
---|---|
private ResolvedMethodName method |
MH_INVOKE_MODS | back to summary |
---|---|
private static final int MH_INVOKE_MODS |
name | back to summary |
---|---|
private String name |
RECOGNIZED_MODIFIERS | back to summary |
---|---|
pack-priv static final int RECOGNIZED_MODIFIERS |
resolution | back to summary |
---|---|
pack-priv Object resolution |
SYNTHETIC | back to summary |
---|---|
pack-priv static final int SYNTHETIC |
TRUSTED_FINAL | back to summary |
---|---|
pack-priv static final int TRUSTED_FINAL |
type | back to summary |
---|---|
private Object type |
VARARGS | back to summary |
---|---|
pack-priv static final int VARARGS |
MemberName | back to summary |
---|---|
public MemberName(Method m) Create a name for the given reflected method. The resulting name will be in a resolved state. |
MemberName | back to summary |
---|---|
public MemberName(Method m, boolean wantSpecial)
|
MemberName | back to summary |
---|---|
public MemberName(Constructor<?> ctor) Create a name for the given reflected constructor. The resulting name will be in a resolved state.
|
MemberName | back to summary |
---|---|
public MemberName(Field fld) Create a name for the given reflected field. The resulting name will be in a resolved state. |
MemberName | back to summary |
---|---|
public MemberName(Field fld, boolean makeSetter)
|
MemberName | back to summary |
---|---|
public MemberName(Class<?> type) Create a name for the given class. The resulting name will be in a resolved state. |
MemberName | back to summary |
---|---|
pack-priv MemberName() |
MemberName | back to summary |
---|---|
public MemberName(Class<?> defClass, String name, Class<?> type, byte refKind) Create a field or type name from the given components: Declaring class, name, type, reference kind. The declaring class may be supplied as null if this is to be a bare name and type. The resulting name will in an unresolved state. |
MemberName | back to summary |
---|---|
public MemberName(Class<?> defClass, String name, MethodType type, byte refKind) 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 |
MemberName | back to summary |
---|---|
public MemberName(byte refKind, Class<?> defClass, String name, Object type) Create a method, constructor, or field name from the given components: Reference kind, declaring class, name, type. |
allFlagsSet | back to summary |
---|---|
private boolean allFlagsSet(int flags) |
anyFlagSet | back to summary |
---|---|
private boolean anyFlagSet(int flags) |
asConstructor | back to summary |
---|---|
public MemberName asConstructor() If this MN is not REF_newInvokeSpecial, return a clone with that ref. kind. In that case it must already be REF_invokeSpecial. |
asNormalOriginal | back to summary |
---|---|
public MemberName asNormalOriginal() If this MN is a REF_invokeSpecial, return a clone with the "normal" kind REF_invokeVirtual; also switch either to REF_invokeInterface if clazz.isInterface. The end result is to get a fully virtualized version of the MN. (Note that resolving in the JVM will sometimes devirtualize, changing REF_invokeVirtual of a final to REF_invokeSpecial, and REF_invokeInterface in some corner cases to either of the previous two; this transform undoes that change under the assumption that it occurred.) |
asSpecial | back to summary |
---|---|
public MemberName asSpecial() |
canBeStaticallyBound | back to summary |
---|---|
public boolean canBeStaticallyBound() Utility method to query whether this member or its defining class is final. |
changeReferenceKind | back to summary |
---|---|
private MemberName changeReferenceKind(byte refKind, byte oldKind) |
clone | back to summary |
---|---|
protected MemberName clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true , but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true , this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
|
ensureTypeVisible | back to summary |
---|---|
pack-priv void ensureTypeVisible(Class<?> refc) |
equals | back to summary |
---|---|
public boolean equals(Object that) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. |
equals | back to summary |
---|---|
public boolean equals(MemberName that) Decide if two member names have exactly the same symbolic content. Does not take into account any actual class members, so even if two member names resolve to the same actual member, they may be distinct references. |
expandFromVM | back to summary |
---|---|
private void expandFromVM() Calls down to the VM to fill in the fields. This method is synchronized to avoid racing calls. |
flagsMods | back to summary |
---|---|
private static int flagsMods(int flags, int mods, byte refKind) |
getClassLoader | back to summary |
---|---|
public ClassLoader getClassLoader() Utility method producing the class loader of the declaring class. |
getDeclaringClass | back to summary |
---|---|
public Class Implements java. Return the declaring class of this member. In the case of a bare name and type, the declaring class will be null.
|
getDefinition | back to summary |
---|---|
public MemberName getDefinition() Get the definition of this member name. This may be in a super-class of the declaring class of this member. |
getFactory | back to summary |
---|---|
pack-priv static MemberName. Actually making a query requires an access check. |
getFieldType | back to summary |
---|---|
public Class Return the declared type of this member, which must be a field or type. If it is a type member, that type itself is returned. |
getInvocationType | back to summary |
---|---|
public MethodType getInvocationType() Return the actual type under which this method or constructor must be invoked. For non-static methods or constructors, this is the type with a leading parameter, a reference to declaring class. For static methods, it is the same as the declared type. |
getMethodDescriptor | back to summary |
---|---|
pack-priv String getMethodDescriptor() Return the descriptor of this member, which must be a method or constructor. |
getMethodOrFieldType | back to summary |
---|---|
public MethodType getMethodOrFieldType() |
getMethodType | back to summary |
---|---|
public MethodType getMethodType() Return the declared type of this member, which must be a method or constructor. |
getModifiers | back to summary |
---|---|
public int getModifiers() Implements java. Return the modifier flags of this member.
|
getName | back to summary |
---|---|
public String getName() Implements java. Return the simple name of this member.
For a type, it is the same as
|
getName | back to summary |
---|---|
private static String getName(Object obj) |
getReferenceKind | back to summary |
---|---|
public byte getReferenceKind() Return the reference kind of this member, or zero if none. |
getType | back to summary |
---|---|
public Object getType() Utility method to produce either the method type or field type of this member. |
hashCode | back to summary |
---|---|
public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
|
init | back to summary |
---|---|
private void init(Class<?> defClass, String name, Object type, int flags) Initialize a query. It is not resolved. |
initResolved | back to summary |
---|---|
pack-priv void initResolved(boolean isResolved) |
isAbstract | back to summary |
---|---|
public boolean isAbstract() Utility method to query the modifier flags of this member. |
isBridge | back to summary |
---|---|
public boolean isBridge() Utility method to query the modifier flags of this member; returns false if the member is not a method. |
isCallerSensitive | back to summary |
---|---|
public boolean isCallerSensitive() Query whether this member has a CallerSensitive annotation. |
isConstructor | back to summary |
---|---|
public boolean isConstructor() Query whether this member is a constructor. |
isField | back to summary |
---|---|
public boolean isField() Query whether this member is a field. |
isFinal | back to summary |
---|---|
public boolean isFinal() Utility method to query the modifier flags of this member. |
isGetter | back to summary |
---|---|
public boolean isGetter() |
isInvocable | back to summary |
---|---|
public boolean isInvocable() Utility method to query whether this member is a method or constructor. |
isMethod | back to summary |
---|---|
public boolean isMethod() Query whether this member is a method. |
isMethodHandleInvoke | back to summary |
---|---|
public boolean isMethodHandleInvoke() Utility method to query if this member is a method handle invocation (invoke or invokeExact). |
isMethodHandleInvokeName | back to summary |
---|---|
public static boolean isMethodHandleInvokeName(String name) |
isNative | back to summary |
---|---|
public boolean isNative() Utility method to query the modifier flags of this member. |
isObjectPublicMethod | back to summary |
---|---|
private boolean isObjectPublicMethod() |
isPackage | back to summary |
---|---|
public boolean isPackage() Utility method to query whether this member is neither public, private, nor protected. |
isPrivate | back to summary |
---|---|
public boolean isPrivate() Utility method to query the modifier flags of this member. |
isProtected | back to summary |
---|---|
public boolean isProtected() Utility method to query the modifier flags of this member. |
isPublic | back to summary |
---|---|
public boolean isPublic() Utility method to query the modifier flags of this member. |
isResolved | back to summary |
---|---|
public boolean isResolved() Query whether this member name is resolved. A resolved member name is one for which the JVM has found a method, constructor, field, or type binding corresponding exactly to the name. (Document?) |
isSetter | back to summary |
---|---|
public boolean isSetter() |
isStatic | back to summary |
---|---|
public boolean isStatic() Utility method to query the modifier flags of this member. |
isSynthetic | back to summary |
---|---|
public boolean isSynthetic() Implements java. Utility method to query the modifier flags of this member; returns false if the member is not a method.
|
isTrustedFinalField | back to summary |
---|---|
public boolean isTrustedFinalField() Query whether this member is a trusted final field. |
isType | back to summary |
---|---|
public boolean isType() Query whether this member is a type. |
isVarargs | back to summary |
---|---|
public boolean isVarargs() Utility method to query the modifier flags of this member; returns false if the member is not a method. |
isVarHandleMethodInvoke | back to summary |
---|---|
public boolean isVarHandleMethodInvoke() |
isVarHandleMethodInvokeName | back to summary |
---|---|
public static boolean isVarHandleMethodInvokeName(String name) |
isVolatile | back to summary |
---|---|
public boolean isVolatile() Utility method to query the modifier flags of this member. |
makeAccessException | back to summary |
---|---|
public IllegalAccessException makeAccessException(String message, Object from) |
makeAccessException | back to summary |
---|---|
public ReflectiveOperationException makeAccessException() |
makeMethodHandleInvoke | back to summary |
---|---|
pack-priv static MemberName makeMethodHandleInvoke(String name, MethodType type) Create a name for a signature-polymorphic invoker.
This is a placeholder for a signature-polymorphic instance
(of MH.invokeExact, etc.) that the JVM does not reify.
See comments on |
makeMethodHandleInvoke | back to summary |
---|---|
pack-priv static MemberName makeMethodHandleInvoke(String name, MethodType type, int mods) |
makeVarHandleMethodInvoke | back to summary |
---|---|
pack-priv static MemberName makeVarHandleMethodInvoke(String name, MethodType type) |
makeVarHandleMethodInvoke | back to summary |
---|---|
pack-priv static MemberName makeVarHandleMethodInvoke(String name, MethodType type, int mods) |
matchingFlagsSet | back to summary |
---|---|
private boolean matchingFlagsSet(int mask, int flags) |
message | back to summary |
---|---|
private String message() |
referenceKindIsConsistent | back to summary |
---|---|
private boolean referenceKindIsConsistent() |
referenceKindIsConsistentWith | back to summary |
---|---|
pack-priv boolean referenceKindIsConsistentWith(int originalRefKind) |
refersTo | back to summary |
---|---|
public boolean refersTo(Class<?> declc, String n) Check if MemberName is a call to a method named |
staticIsConsistent | back to summary |
---|---|
private boolean staticIsConsistent() |
toString | back to summary |
---|---|
public String toString() Overrides java. Produce a string form of this member name.
For types, it is simply the type's own string (as reported by
|
vminfoIsConsistent | back to summary |
---|---|
private boolean vminfoIsConsistent() |
Modifier and Type | Field and Description |
---|---|
pack-priv static final MemberName. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private MemberName | resolve(byte refKind, MemberName ref, Class<?> lookupClass, int allowedModes, boolean speculativeResolve)
Produce a resolved version of the given member. |
public <NoSuchMemberException extends ReflectiveOperationException> MemberName | resolveOrFail(byte refKind, MemberName m, Class<?> lookupClass, int allowedModes, Class<NoSuchMemberException> nsmClass)
Produce a resolved version of the given member. |
public MemberName | resolveOrNull(byte refKind, MemberName m, Class<?> lookupClass, int allowedModes)
Produce a resolved version of the given member. |
INSTANCE | back to summary |
---|---|
pack-priv static final MemberName. |
Factory | back to summary |
---|---|
private Factory() |
resolve | back to summary |
---|---|
private MemberName resolve(byte refKind, MemberName ref, Class<?> lookupClass, int allowedModes, boolean speculativeResolve) Produce a resolved version of the given member.
Super types are searched (for inherited members) if |
resolveOrFail | back to summary |
---|---|
public <NoSuchMemberException extends ReflectiveOperationException> MemberName resolveOrFail(byte refKind, MemberName m, Class<?> lookupClass, int allowedModes, Class<NoSuchMemberException> nsmClass) throws IllegalAccessException, Class-:NoSuchMemberException Produce a resolved version of the given member.
Super types are searched (for inherited members) if |
resolveOrNull | back to summary |
---|---|
public MemberName resolveOrNull(byte refKind, MemberName m, Class<?> lookupClass, int allowedModes) Produce a resolved version of the given member.
Super types are searched (for inherited members) if |