polyglot.types
Interface MethodInstance

All Superinterfaces:
java.lang.Cloneable, CodeInstance, Copy, 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)
          Set the method's containing type.
 MethodInstance flags(Flags flags)
          Set the method's flags.
 MethodInstance formalTypes(java.util.List l)
          Set the method's formal parameter types.
 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)
          Set the method's name.
 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)
          Set the method's return type.
 MethodInstance throwTypes(java.util.List l)
          Set the method's exception throw types.
 
Methods inherited from interface polyglot.types.ProcedureInstance
callValid, callValidImpl, designator, formalTypes, hasFormals, hasFormalsImpl, moreSpecific, moreSpecificImpl, signature, throwsSubset, throwsSubsetImpl, throwTypes
 
Methods inherited from interface polyglot.types.MemberInstance
container, flags
 
Methods inherited from interface polyglot.types.TypeObject
equalsImpl, isCanonical, position, typeSystem
 
Methods inherited from interface polyglot.util.Copy
copy
 

Method Detail

returnType

Type returnType()
The method's return type.


returnType

MethodInstance returnType(Type returnType)
Set the method's return type.


name

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


name

MethodInstance name(java.lang.String name)
Set the method's name.


flags

MethodInstance flags(Flags flags)
Set the method's flags.


formalTypes

MethodInstance formalTypes(java.util.List l)
Set the method's formal parameter types.

Parameters:
l - A list of Type.
See Also:
Type

throwTypes

MethodInstance throwTypes(java.util.List l)
Set the method's exception throw types.

Parameters:
l - A list of Type.
See Also:
Type

container

MethodInstance container(ReferenceType container)
Set the method's containing type.


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.