public class JMethod extends JNode implements HasEnclosingType, HasName, HasType, CanBeAbstract, CanBeSetFinal, CanBeNative, CanBeStatic
HasName.Util| Modifier and Type | Field and Description |
|---|---|
static JMethod |
NULL_METHOD |
protected String |
signature |
| Constructor and Description |
|---|
JMethod(SourceInfo info,
String name,
JDeclaredType enclosingType,
JType returnType,
boolean isAbstract,
boolean isStatic,
boolean isFinal,
AccessModifier access)
These are only supposed to be constructed by JProgram.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOverride(JMethod toAdd)
Add a method that this method overrides.
|
void |
addOverrides(List<JMethod> toAdd)
Add methods that this method overrides.
|
void |
addParam(JParameter x)
Adds a parameter to this method.
|
void |
addThrownException(JClassType exceptionType) |
void |
addThrownExceptions(List<JClassType> exceptionTypes) |
boolean |
canBePolymorphic()
Returns true if this method can participate in virtual dispatch.
|
void |
freezeParamTypes() |
AccessModifier |
getAccess() |
JAbstractMethodBody |
getBody() |
JDeclaredType |
getEnclosingType() |
static JMethod |
getExternalizedMethod(String fullClassName,
String signature,
boolean isStatic)
Creates an externalized representation for a method that needs to be resolved.
|
String |
getName() |
List<JType> |
getOriginalParamTypes() |
JType |
getOriginalReturnType() |
List<JMethod> |
getOverrides()
Returns the transitive closure of all the methods this method overrides.
|
List<JParameter> |
getParams()
Returns the parameters of this method.
|
String |
getSignature() |
List<JClassType> |
getThrownExceptions() |
JType |
getType()
Returns the type of this expression.
|
boolean |
isAbstract() |
boolean |
isConstructor() |
boolean |
isDefault() |
boolean |
isExternal() |
boolean |
isFinal() |
boolean |
isNative() |
boolean |
isPrivate() |
boolean |
isStatic() |
boolean |
isSynthetic() |
boolean |
isTrace() |
boolean |
needsVtable()
Returns
true if this method can participate in instance
dispatch. |
void |
removeParam(int index)
Removes the parameter at the specified index.
|
void |
resolve(JType originalReturnType,
List<JType> originalParamTypes,
JType returnType,
List<JClassType> thrownExceptions)
Resolve an external references during AST stitching.
|
void |
setAbstract(boolean isAbstract) |
void |
setBody(JAbstractMethodBody body) |
void |
setFinal() |
void |
setOriginalTypes(JType returnType,
List<JType> paramTypes) |
void |
setSynthetic() |
void |
setTrace() |
void |
setType(JType newType) |
protected void |
traceAfter(JVisitor visitor,
String before) |
protected String |
traceBefore(JVisitor visitor) |
void |
traverse(JVisitor visitor,
Context ctx)
Causes this object to have the visitor visit itself and its children.
|
protected void |
visitChildren(JVisitor visitor) |
protected Object |
writeReplace() |
getSourceInfo, setSourceInfo, toSource, toStringpublic static final JMethod NULL_METHOD
protected transient String signature
public JMethod(SourceInfo info, String name, JDeclaredType enclosingType, JType returnType, boolean isAbstract, boolean isStatic, boolean isFinal, AccessModifier access)
public static JMethod getExternalizedMethod(String fullClassName, String signature, boolean isStatic)
fullClassName - the class where the method is defined.signature - the signature of the method (including its name).public void addOverride(JMethod toAdd)
public void addParam(JParameter x)
public void addThrownException(JClassType exceptionType)
public void addThrownExceptions(List<JClassType> exceptionTypes)
public boolean canBePolymorphic()
public void freezeParamTypes()
public AccessModifier getAccess()
public JAbstractMethodBody getBody()
public JDeclaredType getEnclosingType()
getEnclosingType in interface HasEnclosingTypepublic JType getOriginalReturnType()
public List<JMethod> getOverrides()
public List<JParameter> getParams()
public String getSignature()
public List<JClassType> getThrownExceptions()
public JType getType()
HasTypepublic boolean isAbstract()
isAbstract in interface CanBeAbstractpublic boolean isConstructor()
public boolean isDefault()
public boolean isExternal()
public boolean isFinal()
isFinal in interface CanBeFinalpublic boolean isNative()
isNative in interface CanBeNativepublic boolean isPrivate()
public boolean isStatic()
isStatic in interface CanBeStaticpublic boolean isSynthetic()
public boolean isTrace()
public boolean needsVtable()
true if this method can participate in instance
dispatch.public void removeParam(int index)
public void resolve(JType originalReturnType, List<JType> originalParamTypes, JType returnType, List<JClassType> thrownExceptions)
public void setAbstract(boolean isAbstract)
public void setBody(JAbstractMethodBody body)
public void setFinal()
setFinal in interface CanBeSetFinalpublic void setSynthetic()
public void setTrace()
public void setType(JType newType)
public void traverse(JVisitor visitor, Context ctx)
JVisitabletraverse in interface JVisitablevisitor - the visitor that should traverse this nodectx - the context of an existing traversalprotected void visitChildren(JVisitor visitor)
protected Object writeReplace()
Copyright © 2018. All rights reserved.