public class RefMethodImpl extends RefJavaElementImpl implements RefMethod
IS_REACHABLE_MASK, LOGmyChildren, myFlags, myManagerEMPTY_ELEMENTS_ARRAY| Modifier | Constructor and Description |
|---|---|
protected |
RefMethodImpl(java.lang.String name,
RefClass ownerClass) |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(RefVisitor visitor)
Accepts the specified visitor and passes self to one of its visit methods.
|
void |
add(RefEntity child) |
void |
addSuperMethod(RefMethodImpl refSuperMethod) |
void |
buildReferences() |
static PsiMethod |
findPsiMethod(PsiManager manager,
java.lang.String externalName) |
java.util.List<RefEntity> |
getChildren()
Returns the list of children of the node.
|
java.util.Collection<RefMethod> |
getDerivedMethods()
Returns the collection of the overriding methods of this method in the
analysis scope.
|
java.lang.String |
getExternalName()
Returns a user-readable name for the element corresponding to the node.
|
java.lang.String |
getName()
Returns the name of the node.
|
RefClass |
getOwnerClass()
Returns the class to which the method belongs.
|
RefParameter [] |
getParameters()
Returns the list of reference graph nodes for the method parameters.
|
java.lang.String |
getReturnValueIfSame()
If the method always returns the same value, returns that value (the name of a static
final field or the text of a literal expression).
|
java.util.Collection<RefMethod> |
getSuperMethods()
Returns the collection of the direct super methods of this method in the
analysis scope.
|
UDeclaration |
getUastElement() |
PsiClass [] |
getUnThrownExceptions()
Returns the list of exceptions which are included in the
throws list
of the method but cannot be actually thrown. |
boolean |
hasBody()
Checks if this method has a body (that is, not a method of an interface or an abstract
method).
|
boolean |
hasSuperMethods()
Checks if the method has super methods either in the analysis scope or outside of it.
|
boolean |
hasSuspiciousCallers() |
protected void |
initialize() |
boolean |
isAbstract()
Checks if the method is abstract.
|
boolean |
isAppMain()
Checks if the signature of the method matches the signature of the standard
main
or premain method. |
boolean |
isBodyEmpty()
Checks if the method has no body or its body contains no statements besides
(possibly) a call to its super method.
|
boolean |
isCalledOnSubClass() |
boolean |
isConstructor()
Checks if the method is a constructor.
|
static boolean |
isEmptyExpression(UExpression expression) |
boolean |
isExternalOverride()
Checks if the method overrides a method outside the current analysis scope.
|
boolean |
isOnlyCallsSuper()
Checks if the method has a body which consists only of the call to its super method.
|
boolean |
isReferenced()
Checks if this element is referenced by any other elements.
|
boolean |
isReturnValueUsed()
Checks if the return value of the method is used by any of its callers.
|
boolean |
isSuspicious() |
boolean |
isTestMethod()
Checks if the method is a test method in a testcase class.
|
void |
markExtended(RefMethodImpl method) |
void |
referenceRemoved() |
void |
removeUnThrownExceptions(PsiClass unThrownException) |
void |
setBodyEmpty(boolean bodyEmpty) |
void |
setLibraryOverride(boolean libraryOverride) |
void |
setParametersAreUnknown() |
void |
updateThrowsList(PsiClassType exceptionType) |
getAccessModifier, getIcon, getName, getOutTypeReferences, isFinal, isProtectedAccessForbidden, isStatic, isSuspiciousRecursive, isSyntheticJSP, markReferenced, setAccessModifieraddInReference, addOutReference, addSuppression, getContainingEntry, getContainingFile, getInReferences, getModule, getOutReferences, getPointer, getPsiElement, getURL, getVirtualFile, isDeleted, isEntry, isPermanentEntry, isReachable, isSuppressed, isValid, setEntry, setPermanentEntry, setReachablecheckFlag, getOwner, getQualifiedName, getRefManager, removeChild, setFlag, setOwner, toStringchangeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMapequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetElementgetAccessModifier, getOutTypeReferences, getPsiElement, isFinal, isStatic, isSyntheticJSPgetContainingEntry, getInReferences, getModule, getOutReferences, getPointer, isEntry, isPermanentEntry, isReachablegetIcon, getOwner, getQualifiedName, getRefManager, isValidgetUserData, putUserDataremoveChild, setOwnerprotected RefMethodImpl(java.lang.String name,
RefClass ownerClass)
public void add(RefEntity child)
add in interface WritableRefEntityadd in class RefEntityImplpublic java.util.List<RefEntity> getChildren()
RefEntitygetChildren in interface RefEntitygetChildren in class RefEntityImplprotected void initialize()
initialize in class RefElementImplpublic void setParametersAreUnknown()
public java.util.Collection<RefMethod> getSuperMethods()
RefMethodgetSuperMethods in interface RefMethodPsiMethod.findSuperMethods(),
RefMethod.hasSuperMethods()public java.util.Collection<RefMethod> getDerivedMethods()
RefMethodgetDerivedMethods in interface RefMethodpublic boolean isBodyEmpty()
RefMethodisBodyEmpty in interface RefMethodpublic boolean isOnlyCallsSuper()
RefMethodisOnlyCallsSuper in interface RefMethodpublic boolean hasBody()
RefMethodpublic void addSuperMethod(RefMethodImpl refSuperMethod)
public void markExtended(RefMethodImpl method)
public RefParameter [] getParameters()
RefMethodgetParameters in interface RefMethodpublic void buildReferences()
buildReferences in class RefElementImplpublic void removeUnThrownExceptions(PsiClass unThrownException)
public void accept(RefVisitor visitor)
RefEntityaccept in interface RefEntityaccept in class RefEntityImplvisitor - the visitor to accept.public boolean isExternalOverride()
RefMethodisExternalOverride in interface RefMethodpublic boolean isAppMain()
RefMethodmain
or premain method.public boolean isAbstract()
RefMethodisAbstract in interface RefMethodpublic boolean hasSuperMethods()
RefMethodhasSuperMethods in interface RefMethodRefMethod.getSuperMethods()public boolean isReferenced()
RefElementisReferenced in interface RefElementisReferenced in class RefElementImplpublic boolean hasSuspiciousCallers()
hasSuspiciousCallers in class RefElementImplpublic boolean isConstructor()
RefMethodisConstructor in interface RefMethodpublic RefClass getOwnerClass()
RefMethodgetOwnerClass in interface RefMethodpublic java.lang.String getName()
RefEntitygetName in interface RefEntitygetName in class RefEntityImplpublic java.lang.String getExternalName()
RefEntitygetExternalName in interface RefEntitygetExternalName in class RefElementImplpublic static PsiMethod findPsiMethod(PsiManager manager, java.lang.String externalName)
public void referenceRemoved()
referenceRemoved in class RefJavaElementImplpublic boolean isSuspicious()
isSuspicious in class RefElementImplpublic boolean isReturnValueUsed()
RefMethodisReturnValueUsed in interface RefMethodpublic java.lang.String getReturnValueIfSame()
RefMethodgetReturnValueIfSame in interface RefMethodpublic void updateThrowsList(PsiClassType exceptionType)
public PsiClass [] getUnThrownExceptions()
RefMethodthrows list
of the method but cannot be actually thrown.
To return valid results, requires com.intellij.codeInspection.unneededThrows.RedundantThrowsGraphAnnotator.
(Dbl) Annotator registration is possible in InspectionProfileEntry.initialize(com.intellij.codeInspection.GlobalInspectionContext)
or GlobalInspectionTool.getAnnotator(RefManager)getUnThrownExceptions in interface RefMethodpublic void setLibraryOverride(boolean libraryOverride)
public void setBodyEmpty(boolean bodyEmpty)
public boolean isTestMethod()
RefMethodisTestMethod in interface RefMethodpublic UDeclaration getUastElement()
getUastElement in interface RefJavaElementgetUastElement in interface RefMethodpublic boolean isCalledOnSubClass()
isCalledOnSubClass in interface RefMethodpublic static boolean isEmptyExpression(UExpression expression)