public final class MethodReference extends MemberReference
Modifier and Type | Field and Description |
---|---|
private TypeReference[] |
parameterTypes
types of parameters (not including "this", if virtual)
|
private RVMMethod |
resolvedMember
The RVMMethod that this method reference resolved to (null if not yet resolved).
|
private TypeReference |
returnType
type of return value
|
descriptor, id, name, type
Constructor and Description |
---|
MethodReference(TypeReference tr,
Atom mn,
Atom d,
int id) |
Modifier and Type | Method and Description |
---|---|
boolean |
definitelyDifferent(MethodReference that)
Do this and that definitely refer to different methods?
|
boolean |
definitelySame(MethodReference that)
Do this and that definitely refer to the same method?
|
static MethodReference |
findOrCreate(TypeReference tRef,
Atom mn,
Atom md)
Find or create a method reference
|
TypeReference[] |
getParameterTypes() |
int |
getParameterWords() |
RVMMethod |
getResolvedMember()
Get the member this reference has been resolved to, if
it has already been resolved.
|
TypeReference |
getReturnType() |
boolean |
isMagic()
Is the method reference to a magic method?
|
boolean |
isMiranda()
Return
true iff this member reference refers to a method which
is declared as part of an abstract class but actually is an
interface method, known formally as a "miranda method". |
boolean |
isResolved() |
boolean |
isSpecializedInvoke()
Is the method reference to a specialized invoke?
|
boolean |
isSysCall()
Is the method reference to a magic method?
|
RVMMethod |
peekInterfaceMethod()
Find the RVMMethod that this member reference refers to using
the search order specified in JVM spec 5.4.3.4.
|
RVMMethod |
peekResolvedMethod()
Find the RVMMethod that this method reference refers to using
the search order specified in JVM spec 5.4.3.3.
|
RVMMethod |
resolve()
Find the RVMMethod that this field reference refers to using
the search order specified in JVM specification 5.4.3.3.
|
RVMMethod |
resolveInterfaceMethod()
Find the RVMMethod that this member reference refers to using
the search order specified in JVM spec 5.4.3.4.
|
private RVMMethod |
resolveInterfaceMethodInternal(RVMClass declaringClass)
Find the RVMMethod that this member reference refers to using
the search order specified in JVM spec 5.4.3.4.
|
private RVMMethod |
resolveInternal(RVMClass declaringClass)
Find the RVMMethod that this member reference refers to using
the search order specified in JVM spec 5.4.3.3.
|
RVMMethod |
resolveInvokeSpecial()
Resolves the method reference for an invoke special into a target
method, if that is possible without causing classloading.
|
private RVMMethod |
searchInterfaceMethods(RVMClass c) |
(package private) void |
setResolvedMember(RVMMethod it) |
asFieldReference, asMethodReference, equals, getDescriptor, getFieldRef, getId, getMemberRef, getMethodRef, getName, getNextId, getType, hashCode, isFieldReference, isMethodReference, needsDynamicLink, parse, parse, peekResolvedMember, resolveMember, toString
private final TypeReference returnType
private final TypeReference[] parameterTypes
private RVMMethod resolvedMember
MethodReference(TypeReference tr, Atom mn, Atom d, int id)
tr
- a type reference to the defining class in which this method
appears. (e.g., "Ljava/lang/String;")mn
- the name of this method (e.g., "equals")d
- the method descriptor (e.g., "(Ljava/lang/Object;)Z")id
- the new ID of the member were a new member requiredpublic static MethodReference findOrCreate(TypeReference tRef, Atom mn, Atom md)
tRef
- the type referencemn
- the name of the membermd
- the descriptor of the membernull
MemberReference.findOrCreate(TypeReference, Atom, Atom)
public TypeReference getReturnType()
public TypeReference[] getParameterTypes()
public int getParameterWords()
public boolean definitelyDifferent(MethodReference that)
that
- the reference to compare withtrue
if the methods are definitely different, false
if it's not known (e.g. because at least one of the method references is
unresolved)public boolean definitelySame(MethodReference that)
that
- the reference to compare withtrue
if the methods are definitely the same, false
if it's not known (e.g. because at least one of the method references is
unresolved)public boolean isResolved()
true
if the method reference has already been resolved
into a target methodpublic RVMMethod getResolvedMember()
null
if not yet resolvedvoid setResolvedMember(RVMMethod it)
public RVMMethod resolveInvokeSpecial()
null
if the method cannot be resolved without classloading.public RVMMethod peekResolvedMethod()
null
if it cannot be resolved.public RVMMethod resolve()
public boolean isMiranda()
true
iff this member reference refers to a method which
is declared as part of an abstract class but actually is an
interface method, known formally as a "miranda method".
This method is necessary to handle the special case where an invokevirtual is defined on an abstract class, where the method invocation points to a method inherited from an interface.
true
iff this member method reference is a miranda methodpublic boolean isMagic()
true
if this method reference is for a magic methodpublic boolean isSpecializedInvoke()
true
if this method reference is for a specialized invokepublic boolean isSysCall()
true
if this method reference is for a sysCall methodprivate RVMMethod resolveInternal(RVMClass declaringClass)
declaringClass
- the class that declared the methodpublic RVMMethod peekInterfaceMethod()
null
if it cannot be resolved without trigering class loadingpublic RVMMethod resolveInterfaceMethod() throws IncompatibleClassChangeError, NoSuchMethodError
IncompatibleClassChangeError
NoSuchMethodError
private RVMMethod resolveInterfaceMethodInternal(RVMClass declaringClass)
declaringClass
- the class that declared the methodnull
for errorprivate RVMMethod searchInterfaceMethods(RVMClass c)