public class JMethod extends JNode implements HasEnclosingType, HasName, HasType, CanBeAbstract, CanBeSetFinal, CanBeNative, CanBeStatic
| Type | Property and Description |
|---|---|
boolean |
isJs
Gets the value of the property jsProperty.
|
| Modifier and Type | Class and Description |
|---|---|
static class |
JMethod.Specialization
AST representation of @SpecializeMethod.
|
HasName.Util| Modifier and Type | Field and Description |
|---|---|
static Comparator<JMethod> |
BY_SIGNATURE_COMPARATOR |
static JMethod |
NULL_METHOD |
protected String |
signature |
BY_NAME_COMPARATOR| 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 |
addOverriddenMethod(JMethod toAdd)
Add a method 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.
|
boolean |
exposesOverriddenPackagePrivateMethod()
Returns true if this method overrides a package private method and increases its
visibility.
|
void |
freezeParamTypes() |
AccessModifier |
getAccess() |
JAbstractMethodBody |
getBody() |
JDeclaredType |
getEnclosingType() |
String |
getExportName() |
static JMethod |
getExternalizedMethod(String fullClassName,
String signature,
boolean isStatic)
Creates an externalized representation for a method that needs to be resolved.
|
String |
getJsniSignature(boolean includeEnclosingClass,
boolean includeReturnType) |
String |
getName() |
List<JType> |
getOriginalParamTypes() |
JType |
getOriginalReturnType() |
List<JMethod> |
getOverriddenMethods()
Returns the transitive closure of all the methods this method overrides.
|
List<JParameter> |
getParams()
Returns the parameters of this method.
|
String |
getQualifiedExportName() |
String |
getSignature() |
JMethod.Specialization |
getSpecialization() |
List<JClassType> |
getThrownExceptions() |
JType |
getType()
Returns the type of this expression.
|
boolean |
isAbstract() |
boolean |
isConstructor() |
boolean |
isDefault() |
boolean |
isExternal() |
boolean |
isFinal() |
boolean |
isInliningAllowed() |
boolean |
isJsProperty()
Gets the value of the property jsProperty.
|
boolean |
isNative() |
boolean |
isNoExport() |
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 |
removeSpecialization() |
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 |
setExportName(String exportName) |
void |
setFinal() |
void |
setInliningAllowed(boolean inliningAllowed) |
void |
setJsProperty(boolean jsProperty) |
void |
setNoExport(boolean noExport) |
void |
setOriginalTypes(JType returnType,
List<JType> paramTypes) |
void |
setSpecialization(List<JType> paramTypes,
JType returnsType,
String targetMethod) |
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 Comparator<JMethod> BY_SIGNATURE_COMPARATOR
public 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 boolean isNoExport()
public void setNoExport(boolean noExport)
public void setExportName(String exportName)
public String getExportName()
public void setJsProperty(boolean jsProperty)
public boolean isJsProperty()
public void setSpecialization(List<JType> paramTypes, JType returnsType, String targetMethod)
public JMethod.Specialization getSpecialization()
public void removeSpecialization()
public String getQualifiedExportName()
public boolean isInliningAllowed()
public void setInliningAllowed(boolean inliningAllowed)
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 addOverriddenMethod(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 boolean exposesOverriddenPackagePrivateMethod()
public AccessModifier getAccess()
public JAbstractMethodBody getBody()
public JDeclaredType getEnclosingType()
getEnclosingType in interface HasEnclosingTypepublic JType getOriginalReturnType()
public List<JMethod> getOverriddenMethods()
public List<JParameter> getParams()
public String getSignature()
public String getJsniSignature(boolean includeEnclosingClass, boolean includeReturnType)
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.