polyglot.types
Interface MethodInstance

All Superinterfaces:
java.lang.Cloneable, CodeInstance, Copy, Declaration, MemberInstance, ProcedureInstance, java.io.Serializable, TypeObject
All Known Subinterfaces:
CofferMethodInstance
All Known Implementing Classes:
CofferMethodInstance_c, MethodInstance_c

public interface MethodInstance
extends ProcedureInstance

A MethodInstance represents the type information for a Java method.


Method Summary
 boolean canOverride(MethodInstance mi)
          Return true if this method can override mi, false otherwise.
 boolean canOverrideImpl(MethodInstance mi, boolean quiet)
          Return true if this method can override mi.
 void checkOverride(MethodInstance mi)
          Return true if this method can override mi, throws a SemanticException otherwise.
 MethodInstance container(ReferenceType container)
           
 MethodInstance flags(Flags flags)
          Non-destructive updates.
 MethodInstance formalTypes(java.util.List l)
           
 java.util.List implemented()
          Get the set of methods this method implements.
 java.util.List implementedImpl(ReferenceType rt)
          Get the set of methods in rt and its superinterfaces that this method implements.
 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 actualTypes)
          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 actualTypes)
          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 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 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 method's return type.
 MethodInstance returnType(Type returnType)
           
 void setName(java.lang.String name)
          Destructively set the method's name.
 void setReturnType(Type type)
          Destructively set the method's return type.
 MethodInstance throwTypes(java.util.List l)
           
 
Methods inherited from interface polyglot.types.ProcedureInstance
callValid, callValidImpl, designator, formalTypes, hasFormals, hasFormalsImpl, moreSpecific, moreSpecificImpl, setFormalTypes, setThrowTypes, signature, throwsSubset, throwsSubsetImpl, throwTypes
 
Methods inherited from interface polyglot.types.MemberInstance
container, flags, setContainer, setFlags
 
Methods inherited from interface polyglot.types.TypeObject
equalsImpl, isCanonical, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 
Methods inherited from interface polyglot.types.Declaration
declaration, setDeclaration
 

Method Detail

returnType

Type returnType()
The method's return type.


setReturnType

void setReturnType(Type type)
Destructively set the method's return type.

Parameters:
type -

name

java.lang.String name()
The method's name.


setName

void setName(java.lang.String name)
Destructively set the method's name.

Parameters:
name -

flags

MethodInstance flags(Flags flags)
Non-destructive updates.


name

MethodInstance name(java.lang.String name)

returnType

MethodInstance returnType(Type returnType)

formalTypes

MethodInstance formalTypes(java.util.List l)

throwTypes

MethodInstance throwTypes(java.util.List l)

container

MethodInstance container(ReferenceType container)

orig

MethodInstance orig()

overrides

java.util.List overrides()
Get the list of methods this method (potentially) overrides, in order from this class (i.e., including this) to super classes.

Returns:
A list of MethodInstance, starting with this. Note that this list does not include methods declared in interfaces. Use implemented for that.
See Also:
MethodInstance

canOverride

boolean canOverride(MethodInstance mi)
Return true if this method can override mi, false otherwise.


checkOverride

void checkOverride(MethodInstance mi)
                   throws SemanticException
Return true if this method can override mi, throws a SemanticException otherwise.

Throws:
SemanticException

implemented

java.util.List implemented()
Get the set of methods this method implements. No ordering is specified since the superinterfaces need not form a linear list (i.e., they can form a tree).

Returns:
List[MethodInstance]

isSameMethod

boolean isSameMethod(MethodInstance mi)
Return true if this method has the same signature as mi.


methodCallValid

boolean methodCallValid(java.lang.String name,
                        java.util.List actualTypes)
Return true if this method can be called with name name and actual parameters of types actualTypes.

Parameters:
name - The method to call.
actualTypes - A list of argument types of type Type.
See Also:
Type

overridesImpl

java.util.List overridesImpl()
Get the list of methods this method (potentially) overrides, in order from this class (i.e., including this) to super classes. This method should not be called except by TypeSystem and by subclasses.

Returns:
A list of MethodInstance, starting with this.
See Also:
MethodInstance

canOverrideImpl

boolean canOverrideImpl(MethodInstance mi,
                        boolean quiet)
                        throws SemanticException
Return true if this method can override 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.

Throws:
SemanticException

implementedImpl

java.util.List implementedImpl(ReferenceType rt)
Get the set of methods in rt and its superinterfaces that this method implements. No ordering is specified.

Parameters:
rt - The point in the type hierarchy to begin looking for methods.
Returns:
List[MethodInstance]

isSameMethodImpl

boolean isSameMethodImpl(MethodInstance mi)
Return true if this method has the same signature as mi. This method should not be called except by TypeSystem and by subclasses.


methodCallValidImpl

boolean methodCallValidImpl(java.lang.String name,
                            java.util.List actualTypes)
Return true if this method can be called with name name and actual parameters of types actualTypes. This method should not be called except by TypeSystem and by subclasses.