|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JMemberDeclaration
org.multijava.mjc.JMethodDeclaration
This class represents a java method in the syntax tree. This classes natural ordering is inconsistent with equals. It is consistent with sameGenericFunction.
| Field Summary | |
private JBlock |
body
|
private CClassType[] |
exceptions
|
private String |
ident
|
private long |
modifiers
|
private JFormalParameter[] |
parameters
|
private CType |
returnType
|
protected CTypeVariable[] |
typevariables
|
| Fields inherited from class org.multijava.mjc.JMemberDeclaration |
|
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
JMethodDeclaration(TokenReference where,
long modifiers,
CTypeVariable[] typevariables,
CType returnType,
String ident,
JFormalParameter[] parameters,
CClassType[] exceptions,
JBlock body,
JavadocComment javadoc,
JavaStyleComment[] comments)
Construct a node in the parsing tree This method is directly called by the parser |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
void |
addBridge(CContextType context,
CMethod method)
|
void |
addParameter(JFormalParameter param)
Adds an additional formal parameter to this method, appending it to the end of the existing parameter list. |
JBlock |
body()
WMD TODO remove WMD TODO remove |
private void |
changeParametersToReadonly(CContextType context,
CType[] params)
|
CMember |
checkInterface(CContextType context)
Checks the basic interfaces to make sure things generally look OK. |
CSourceMethod |
checkInterfaceType(CContextType context,
MemberAccess access,
String ident)
Performs the interface checks that are common to all sorts of methods. |
void |
checkOverriding(CContextType context,
CMethodSet superMethods)
Checks that this method appropriately overrides the given superclass methods. |
private void |
checkUniverseOverriding(CContextType context,
CType[] thisparams,
CMethod superMethod)
|
private void |
checkUniverses(CContextType context)
|
int |
compareTo(Object o)
Compares this method to a given method and returns 0 if the methods belong to the same generic function, otherwise returns -1 or +1 to sort the methods. |
CExtendedClassContext |
createExtendedClassContext(CContextType parent,
CTypeVariable[] typevariables)
Create a Extended Class context that include the typevariables |
CMethodContextType |
createSelfContext(CClassContextType parent)
Creates a context for this method declaration AST node. |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
CClassType[] |
getExceptions()
|
boolean |
hasBody()
|
String |
ident()
|
boolean |
isExternal()
Indicates whether this member is external. |
boolean |
isOverriding()
Return true if this method declaration overrides
any of its superclass (or interfaces) method declarations. |
protected MemberAccess |
makeMemberAccess(CContextType context,
CClass owner)
|
protected CSourceMethod |
makeMethodSignature(CContextType context,
MemberAccess access,
String ident,
CSpecializedType[] parameterTypes)
Generates the signature object for this method declaration. |
long |
modifiers()
|
protected boolean |
noBodyOK(CContextType context,
CMethod self)
|
CMethodSet |
overriddenMethods()
Return the set of methods that are directly overriden (specialized) by this method declaration. |
JFormalParameter[] |
parameters()
|
void |
resolveExtMethods(CContextType context)
Makes sure that all in-scope external generic functions are added to the appropriate augmentation maps before top method searches occur in later passes. |
void |
resolveSpecializers(CContextType context)
Computes the values of specializer expressions used to dispatch on compile-time constants. |
void |
resolveTopMethods()
Finds the top method of every declared method. |
CType |
returnType()
|
void |
setBody(JBlock body)
|
void |
setIdent(String name)
|
void |
setModifiers(long modifiers)
Sets the modifiers of this method declaration |
void |
setParameters(JFormalParameter[] parameters)
|
String |
toString()
|
void |
typecheck(CContextType context)
Typechecks this method declaration. |
boolean |
usesMultipleDispatch()
Indicates whether this method uses multiple dispatch |
| Methods inherited from class org.multijava.mjc.JMemberDeclaration |
genComments, getCClass, getField, getMethod, isDeprecated, javadocComment, setInterface |
| Methods inherited from class org.multijava.mjc.JPhylum |
check, check, check, check, fail, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.multijava.mjc.JMemberDeclarationType |
genComments, getCClass, getField, getMethod, isDeprecated |
| Methods inherited from interface org.multijava.util.compiler.PhylumType |
getTokenReference, setTokenReference |
| Methods inherited from interface org.multijava.javadoc.Annotatable |
javadocComment |
| Field Detail |
private long modifiers
private CType returnType
private String ident
private JFormalParameter[] parameters
private CClassType[] exceptions
private JBlock body
protected CTypeVariable[] typevariables
| Constructor Detail |
public JMethodDeclaration(TokenReference where,
long modifiers,
CTypeVariable[] typevariables,
CType returnType,
String ident,
JFormalParameter[] parameters,
CClassType[] exceptions,
JBlock body,
JavadocComment javadoc,
JavaStyleComment[] comments)
where - the line of this node in the source codemodifiers - list of modifierstypevariables - the type variable of this methodreturnType - the return type of this methodident - the name of this methodparameters - the parameters of this methodexceptions - the exceptions throw by this methodbody - the body of this methodjavadoc - javadoc comments, including whether this
method is deprecatedcomments - regular java style comments| Method Detail |
public JFormalParameter[] parameters()
parameters in interface JMethodDeclarationTypepublic void setParameters(JFormalParameter[] parameters)
setParameters in interface JMethodDeclarationTypepublic void addParameter(JFormalParameter param)
also requires param != null;
addParameter in interface JMethodDeclarationTypepublic String ident()
ident in interface JMethodDeclarationTypepublic CType returnType()
returnType in interface JMethodDeclarationTypepublic CClassType[] getExceptions()
getExceptions in interface JMethodDeclarationTypepublic long modifiers()
modifiers in interface JMethodDeclarationTypepublic void setModifiers(long modifiers)
setModifiers in interface JMethodDeclarationTypepublic JBlock body()
JMethodDeclarationType
body in interface JMethodDeclarationTypepublic boolean hasBody()
hasBody in interface JMethodDeclarationTypepublic void setIdent(String name)
public void setBody(JBlock body)
public boolean isOverriding()
true if this method declaration overrides
any of its superclass (or interfaces) method declarations.
isOverriding in interface JMethodDeclarationTypepublic CMethodSet overriddenMethods()
overriddenMethods in interface JMethodDeclarationTypepublic boolean usesMultipleDispatch()
usesMultipleDispatch in interface JMethodDeclarationType
public int compareTo(Object o)
throws ClassCastException
compareTo in interface JMethodDeclarationTypeo - the object to be compared against, must be a
JMethodDeclarationType
ClassCastException - if o is not an instance of
CType public boolean isExternal()
isExternal in interface JMethodDeclarationType
public CMember checkInterface(CContextType context)
throws PositionedError
checkInterface in interface JMethodDeclarationTypePositionedError - an error with reference to the
source file
public CSourceMethod checkInterfaceType(CContextType context,
MemberAccess access,
String ident)
throws PositionedError
ident
might be extended by this in the given context.
checkInterfaceType in interface JMethodDeclarationTypecontext - the context in which this method appearsaccess - the MemberAccess object for this methodident - the method name (passed as a parameter
instead of using the field to properly
handle constructors where the field is
the class name but ident is <init>
PositionedError, - an error with reference to the
source file
PositionedError - an error with reference to the
source file
public CExtendedClassContext createExtendedClassContext(CContextType parent,
CTypeVariable[] typevariables)
protected CSourceMethod makeMethodSignature(CContextType context,
MemberAccess access,
String ident,
CSpecializedType[] parameterTypes)
protected MemberAccess makeMemberAccess(CContextType context,
CClass owner)
public void resolveSpecializers(CContextType context)
throws PositionedError
resolveSpecializers in interface JMethodDeclarationTypecontext - the context in which this class
declaration appears
PositionedError - if the check fails public void resolveExtMethods(CContextType context)
resolveExtMethods in interface JMethodDeclarationType
public void resolveTopMethods()
throws PositionedError
resolveTopMethods in interface JMethodDeclarationTypePositionedError
private void changeParametersToReadonly(CContextType context,
CType[] params)
throws PositionedError
PositionedError
private void checkUniverses(CContextType context)
throws PositionedError
PositionedError
private void checkUniverseOverriding(CContextType context,
CType[] thisparams,
CMethod superMethod)
throws PositionedError
PositionedErrorpublic CMethodContextType createSelfContext(CClassContextType parent)
createSelfContext in interface JMethodDeclarationTypeparent - the parent context
protected boolean noBodyOK(CContextType context,
CMethod self)
public void typecheck(CContextType context)
throws PositionedError
typecheck in interface JMethodDeclarationTypecontext - the context in which this method appears
PositionedError - if the checks fail and the failure
cannot be recovered from
public void addBridge(CContextType context,
CMethod method)
throws PositionedError
PositionedError
public void checkOverriding(CContextType context,
CMethodSet superMethods)
throws PositionedError
checkOverriding in interface JMethodDeclarationTypecontext - the context in which this appearssuperMethods - the super type methods that this
may override.
PositionedError - if a check failspublic void accept(MjcVisitor p)
accept in interface JMemberDeclarationTypep - the visitorpublic void genCode(CodeSequence code)
code - the code listpublic String toString()
toString in class Object
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||