Class AbstractPoorMethodCall
- java.lang.Object
-
- net.sourceforge.pmd.properties.AbstractPropertySource
-
- net.sourceforge.pmd.lang.rule.AbstractRule
-
- net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
-
- net.sourceforge.pmd.lang.java.rule.AbstractPoorMethodCall
-
- All Implemented Interfaces:
JavaParserVisitor
,ImmutableLanguage
,PropertySource
,Rule
- Direct Known Subclasses:
UseIndexOfCharRule
@Deprecated @InternalApi public abstract class AbstractPoorMethodCall extends AbstractJavaRule
Deprecated.Internal APIDetects and flags the occurrences of specific method calls against an instance of a designated class. I.e. String.indexOf. The goal is to be able to suggest more efficient/modern ways of implementing the same function.Concrete subclasses are expected to provide the name of the target class and an array of method names that we are looking for. We then pass judgment on any literal arguments we find in the subclass as well.
- Author:
- Brian Remedios
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
propertyDescriptors, propertyValuesByDescriptor
-
Fields inherited from interface net.sourceforge.pmd.Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR
-
-
Constructor Summary
Constructors Constructor Description AbstractPoorMethodCall()
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected abstract boolean
isViolationArgument(Node arg)
Deprecated.Returns whether the node being sent to the method is OK or not.protected abstract String[]
methodNames()
Deprecated.Return the names of all the methods we are scanning for, no brackets or argument types.protected abstract String
targetTypename()
Deprecated.The name of the type the method will be invoked against.Object
visit(ASTVariableDeclaratorId node, Object data)
Deprecated.Method visit.-
Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
apply, getDeclaringType, importsPackage, isQualifiedName, isSuppressed, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitAll
-
Methods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule
addExample, addRuleChainVisit, addRuleChainVisit, addViolation, addViolation, addViolation, addViolationWithMessage, addViolationWithMessage, addViolationWithMessage, asCtx, deepCopy, deepCopyValuesTo, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getParserOptions, getPriority, getPropertySourceType, getRuleChainVisits, getRuleClass, getRuleSetName, getSince, hashCode, isDeprecated, isDfa, isMultifile, isRuleChain, isTypeResolution, setDeprecated, setDescription, setDfa, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setMultifile, setName, setPriority, setRuleClass, setRuleSetName, setSince, setTypeResolution, setUsesDFA, setUsesMultifile, setUsesTypeResolution, start, usesDFA, usesMultifile, usesRuleChain, usesTypeResolution
-
Methods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
copyPropertyDescriptors, copyPropertyValues, definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, dysfunctionReason, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, ignoredProperties, isPropertyOverridden, setProperty, setProperty, useDefaultValueFor, usesDefaultValues
-
-
-
-
Method Detail
-
targetTypename
protected abstract String targetTypename()
Deprecated.The name of the type the method will be invoked against.- Returns:
- String
-
methodNames
protected abstract String[] methodNames()
Deprecated.Return the names of all the methods we are scanning for, no brackets or argument types.- Returns:
- String[]
-
isViolationArgument
protected abstract boolean isViolationArgument(Node arg)
Deprecated.Returns whether the node being sent to the method is OK or not. Return true if you want to record the method call as a violation.- Parameters:
arg
- the node to inspect- Returns:
- boolean
-
visit
public Object visit(ASTVariableDeclaratorId node, Object data)
Deprecated.Method visit.- Specified by:
visit
in interfaceJavaParserVisitor
- Overrides:
visit
in classAbstractJavaRule
- Parameters:
node
- ASTVariableDeclaratorIddata
- Object- Returns:
- Object
- See Also:
JavaParserVisitor.visit(ASTVariableDeclaratorId, Object)
-
-