public class RefMethodImpl extends RefJavaElementImpl implements RefMethod
IS_REACHABLE_MASK, LOG
myChildren, myFlags, myManager
EMPTY_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, setAccessModifier
addInReference, addOutReference, addSuppression, getContainingEntry, getContainingFile, getInReferences, getModule, getOutReferences, getPointer, getPsiElement, getURL, getVirtualFile, isDeleted, isEntry, isPermanentEntry, isReachable, isSuppressed, isValid, setEntry, setPermanentEntry, setReachable
checkFlag, getOwner, getQualifiedName, getRefManager, removeChild, setFlag, setOwner, toString
changeUserMap, clearUserData, clone, copyCopyableDataTo, copyUserDataTo, getCopyableUserData, getUserData, getUserDataString, getUserMap, isUserDataEmpty, putCopyableUserData, putUserData, putUserDataIfAbsent, replace, setUserMap
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getElement
getAccessModifier, getOutTypeReferences, getPsiElement, isFinal, isStatic, isSyntheticJSP
getContainingEntry, getInReferences, getModule, getOutReferences, getPointer, isEntry, isPermanentEntry, isReachable
getIcon, getOwner, getQualifiedName, getRefManager, isValid
getUserData, putUserData
removeChild, setOwner
protected RefMethodImpl(java.lang.String name, RefClass ownerClass)
public void add(RefEntity child)
add
in interface WritableRefEntity
add
in class RefEntityImpl
public java.util.List<RefEntity> getChildren()
RefEntity
getChildren
in interface RefEntity
getChildren
in class RefEntityImpl
protected void initialize()
initialize
in class RefElementImpl
public void setParametersAreUnknown()
public java.util.Collection<RefMethod> getSuperMethods()
RefMethod
getSuperMethods
in interface RefMethod
PsiMethod.findSuperMethods()
,
RefMethod.hasSuperMethods()
public java.util.Collection<RefMethod> getDerivedMethods()
RefMethod
getDerivedMethods
in interface RefMethod
public boolean isBodyEmpty()
RefMethod
isBodyEmpty
in interface RefMethod
public boolean isOnlyCallsSuper()
RefMethod
isOnlyCallsSuper
in interface RefMethod
public boolean hasBody()
RefMethod
public void addSuperMethod(RefMethodImpl refSuperMethod)
public void markExtended(RefMethodImpl method)
public RefParameter [] getParameters()
RefMethod
getParameters
in interface RefMethod
public void buildReferences()
buildReferences
in class RefElementImpl
public void removeUnThrownExceptions(PsiClass unThrownException)
public void accept(RefVisitor visitor)
RefEntity
accept
in interface RefEntity
accept
in class RefEntityImpl
visitor
- the visitor to accept.public boolean isExternalOverride()
RefMethod
isExternalOverride
in interface RefMethod
public boolean isAppMain()
RefMethod
main
or premain
method.public boolean isAbstract()
RefMethod
isAbstract
in interface RefMethod
public boolean hasSuperMethods()
RefMethod
hasSuperMethods
in interface RefMethod
RefMethod.getSuperMethods()
public boolean isReferenced()
RefElement
isReferenced
in interface RefElement
isReferenced
in class RefElementImpl
public boolean hasSuspiciousCallers()
hasSuspiciousCallers
in class RefElementImpl
public boolean isConstructor()
RefMethod
isConstructor
in interface RefMethod
public RefClass getOwnerClass()
RefMethod
getOwnerClass
in interface RefMethod
public java.lang.String getName()
RefEntity
getName
in interface RefEntity
getName
in class RefEntityImpl
public java.lang.String getExternalName()
RefEntity
getExternalName
in interface RefEntity
getExternalName
in class RefElementImpl
public static PsiMethod findPsiMethod(PsiManager manager, java.lang.String externalName)
public void referenceRemoved()
referenceRemoved
in class RefJavaElementImpl
public boolean isSuspicious()
isSuspicious
in class RefElementImpl
public boolean isReturnValueUsed()
RefMethod
isReturnValueUsed
in interface RefMethod
public java.lang.String getReturnValueIfSame()
RefMethod
getReturnValueIfSame
in interface RefMethod
public void updateThrowsList(PsiClassType exceptionType)
public PsiClass [] getUnThrownExceptions()
RefMethod
throws
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 RefMethod
public void setLibraryOverride(boolean libraryOverride)
public void setBodyEmpty(boolean bodyEmpty)
public boolean isTestMethod()
RefMethod
isTestMethod
in interface RefMethod
public UDeclaration getUastElement()
getUastElement
in interface RefJavaElement
getUastElement
in interface RefMethod
public boolean isCalledOnSubClass()
isCalledOnSubClass
in interface RefMethod
public static boolean isEmptyExpression(UExpression expression)