public class MethodInstance_c extends ProcedureInstance_c implements MethodInstance
MethodInstance
represents the type information for a Java
method.Modifier and Type | Field and Description |
---|---|
protected MethodInstance |
decl |
protected java.lang.String |
name |
protected Type |
returnType |
container, flags, formalTypes, throwTypes
position, ts
Modifier | Constructor and Description |
---|---|
protected |
MethodInstance_c()
Used for deserializing types.
|
|
MethodInstance_c(TypeSystem ts,
Position pos,
ReferenceType container,
Flags flags,
Type returnType,
java.lang.String name,
java.util.List<? extends Type> formalTypes,
java.util.List<? extends Type> excTypes) |
Modifier and Type | Method and Description |
---|---|
boolean |
canOverride(MethodInstance mj)
Return true if this method can override
mi , false otherwise. |
boolean |
canOverrideImpl(MethodInstance mj)
Deprecated.
|
boolean |
canOverrideImpl(MethodInstance mj,
boolean quiet)
Return true if this method can override
mi . |
void |
checkOverride(MethodInstance mj)
Return true if this method can override
mi , throws
a SemanticException otherwise. |
MethodInstance |
container(ReferenceType container) |
Declaration |
declaration()
Get the original declaration.
|
java.lang.String |
designator()
String describing the kind of procedure, (e.g., "method" or "constructor").
|
boolean |
equalsImpl(TypeObject o)
Default implementation is pointer equality.
|
MethodInstance |
flags(Flags flags)
Non-destructive updates.
|
MethodInstance |
formalTypes(java.util.List<? extends Type> l) |
int |
hashCode() |
java.util.List<? extends MethodInstance> |
implemented()
Get the set of methods this method implements.
|
java.util.List<MethodInstance> |
implementedImpl(ReferenceType rt)
Get the set of methods in rt and its superinterfaces that
this method implements.
|
protected java.util.List<MethodInstance> |
implementedImplAux(ReferenceType rt) |
boolean |
isCanonical()
Return true if the type object contains no unknown/ambiguous types.
|
boolean |
isSameMethod(MethodInstance mi)
Return true if this method has the same signature as
mi . |
boolean |
isSameMethodImpl(MethodInstance mi)
Return true if this method has the same signature as
mi . |
boolean |
methodCallValid(java.lang.String name,
java.util.List<? extends Type> argTypes)
Return true if this method can be called with name
name
and actual parameters of types actualTypes . |
boolean |
methodCallValidImpl(java.lang.String name,
java.util.List<? extends Type> argTypes)
Return true if this method can be called with name
name
and actual parameters of types actualTypes . |
java.lang.String |
name()
The method's name.
|
MethodInstance |
name(java.lang.String name) |
MethodInstance |
orig() |
java.util.List<MethodInstance> |
overrides()
Get the list of methods this method (potentially) overrides, in order
from this class (i.e., including
this ) to super classes. |
java.util.List<MethodInstance> |
overridesImpl()
Get the list of methods this method (potentially) overrides, in order
from this class (i.e., including
this ) to super classes. |
Type |
returnType()
The functions's return type.
|
MethodInstance |
returnType(Type returnType) |
void |
setDeclaration(Declaration decl)
Set the original declaration.
|
void |
setName(java.lang.String name)
Destructively set the method's name.
|
void |
setReturnType(Type returnType)
Destructively set the functions's return type.
|
java.lang.String |
signature()
Returns a String representing the signature of the procedure.
|
MethodInstance |
throwTypes(java.util.List<? extends Type> l) |
java.lang.String |
toString() |
callValid, callValidImpl, container, flags, formalTypes, hasFormals, hasFormalsImpl, listIsCanonical, moreSpecific, moreSpecificImpl, setContainer, setFlags, setFormalTypes, setThrowTypes, throwsSubset, throwsSubsetImpl, throwTypes
copy, equals, position, typeSystem
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
callValid, callValidImpl, formalTypes, hasFormals, hasFormalsImpl, moreSpecific, moreSpecificImpl, setFormalTypes, setThrowTypes, throwsSubset, throwsSubsetImpl, throwTypes
flags
position, typeSystem
container, flags, setContainer, setFlags
protected java.lang.String name
protected Type returnType
protected MethodInstance decl
protected MethodInstance_c()
public MethodInstance_c(TypeSystem ts, Position pos, ReferenceType container, Flags flags, Type returnType, java.lang.String name, java.util.List<? extends Type> formalTypes, java.util.List<? extends Type> excTypes)
public Declaration declaration()
Declaration
declaration
in interface Declaration
public void setDeclaration(Declaration decl)
Declaration
setDeclaration
in interface Declaration
public MethodInstance orig()
orig
in interface MethodInstance
public java.lang.String name()
MethodInstance
name
in interface MethodInstance
public Type returnType()
FunctionInstance
returnType
in interface FunctionInstance
public MethodInstance flags(Flags flags)
MethodInstance
flags
in interface MethodInstance
public MethodInstance name(java.lang.String name)
name
in interface MethodInstance
public MethodInstance returnType(Type returnType)
returnType
in interface MethodInstance
public MethodInstance formalTypes(java.util.List<? extends Type> l)
formalTypes
in interface MethodInstance
public MethodInstance throwTypes(java.util.List<? extends Type> l)
throwTypes
in interface MethodInstance
public MethodInstance container(ReferenceType container)
container
in interface MethodInstance
public void setName(java.lang.String name)
MethodInstance
setName
in interface MethodInstance
name
- the name to setpublic void setReturnType(Type returnType)
FunctionInstance
setReturnType
in interface FunctionInstance
returnType
- the return type to setpublic int hashCode()
hashCode
in class ProcedureInstance_c
public boolean equalsImpl(TypeObject o)
TypeObject_c
equalsImpl
in interface TypeObject
equalsImpl
in class ProcedureInstance_c
TypeObject_c.equalsImpl(TypeObject)
,
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String signature()
ProcedureInstance
signature
in interface ProcedureInstance
public java.lang.String designator()
ProcedureInstance
designator
in interface ProcedureInstance
public final boolean isSameMethod(MethodInstance mi)
MethodInstance
mi
.isSameMethod
in interface MethodInstance
public boolean isSameMethodImpl(MethodInstance mi)
MethodInstance
mi
.
This method should not be called except by TypeSystem
and by subclasses.isSameMethodImpl
in interface MethodInstance
public boolean isCanonical()
TypeObject
isCanonical
in interface TypeObject
public final boolean methodCallValid(java.lang.String name, java.util.List<? extends Type> argTypes)
MethodInstance
name
and actual parameters of types actualTypes
.methodCallValid
in interface MethodInstance
name
- The method to call.argTypes
- A list of argument types of type Type
.Type
public boolean methodCallValidImpl(java.lang.String name, java.util.List<? extends Type> argTypes)
MethodInstance
name
and actual parameters of types actualTypes
.
This method should not be called except by TypeSystem
and by subclasses.methodCallValidImpl
in interface MethodInstance
public java.util.List<MethodInstance> overrides()
MethodInstance
this
) to super classes.overrides
in interface MethodInstance
MethodInstance
, starting with
this
. Note that this list does not include methods declared
in interfaces. Use implemented
for that.MethodInstance
public java.util.List<MethodInstance> overridesImpl()
MethodInstance
this
) to super classes.
This method should not be called except by TypeSystem
and by subclasses.overridesImpl
in interface MethodInstance
MethodInstance
, starting with
this
.MethodInstance
public final boolean canOverride(MethodInstance mj)
MethodInstance
mi
, false otherwise.canOverride
in interface MethodInstance
public final void checkOverride(MethodInstance mj) throws SemanticException
MethodInstance
mi
, throws
a SemanticException otherwise.checkOverride
in interface MethodInstance
SemanticException
@Deprecated public final boolean canOverrideImpl(MethodInstance mj)
public boolean canOverrideImpl(MethodInstance mj, boolean quiet) throws SemanticException
MethodInstance
mi
.
This method should not be called except by TypeSystem
and by subclasses.
If quiet is true and this method cannot override mi
, then
false is returned; otherwise, if quiet is false and this method cannot
override mi
, then a SemanticException is thrown.canOverrideImpl
in interface MethodInstance
quiet
- If true, then no Semantic Exceptions will be thrown, and the
return value will be true or false. Otherwise, if the method
cannot override, then a SemanticException will be thrown, else
the method will return true.SemanticException
public java.util.List<? extends MethodInstance> implemented()
MethodInstance
implemented
in interface MethodInstance
public java.util.List<MethodInstance> implementedImpl(ReferenceType rt)
MethodInstance
implementedImpl
in interface MethodInstance
rt
- The point in the type hierarchy to begin looking for methods.protected java.util.List<MethodInstance> implementedImplAux(ReferenceType rt)