Class ImplicitFunctionalInterfaceRule
- All Implemented Interfaces:
net.sourceforge.pmd.lang.ast.AstVisitor,net.sourceforge.pmd.lang.java.ast.JavaVisitor,net.sourceforge.pmd.lang.rule.Rule,net.sourceforge.pmd.properties.PropertySource
@FunctionalInterface.
Unlike PMD's built-in ImplicitFunctionalInterface rule, this
variant refuses to fire when the interface extends a super-interface whose
type PMD cannot resolve. The built-in rule counts only the abstract methods
it can see: when a super-interface is unresolved (for instance because
Qulice runs PMD without an auxiliary classpath, so types declared in other
files are invisible), the rule misses the abstract methods that
super-interface contributes and wrongly reports the interface as functional.
Adding the suggested @FunctionalInterface annotation to such an
interface does not compile, because the interface really has more than one
abstract method. An interface with a single visible method whose full set of
inherited abstract methods cannot be computed is therefore left alone. Once
the whole super-interface hierarchy resolves, the check is exactly the same
as the built-in one: fire only when the interface has a single abstract
method overall.
- Since:
- 1.0
-
Field Summary
Fields inherited from interface net.sourceforge.pmd.lang.rule.Rule
VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, VIOLATION_SUPPRESS_XPATH_DESCRIPTOR -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRulechainRule
buildTargetSelector, visitJavaNodeMethods inherited from class net.sourceforge.pmd.lang.java.rule.AbstractJavaRule
apply, visitNodeMethods inherited from class net.sourceforge.pmd.lang.rule.AbstractRule
addExample, asCtx, deepCopy, dysfunctionReason, end, equals, getDescription, getExamples, getExternalInfoUrl, getLanguage, getMaximumLanguageVersion, getMessage, getMinimumLanguageVersion, getName, getPriority, getPropertySourceType, getRuleClass, getRuleSetName, getSince, getTargetSelector, hashCode, isDeprecated, setDeprecated, setDescription, setExternalInfoUrl, setLanguage, setMaximumLanguageVersion, setMessage, setMinimumLanguageVersion, setName, setPriority, setRuleClass, setRuleSetName, setSince, startMethods inherited from class net.sourceforge.pmd.properties.AbstractPropertySource
definePropertyDescriptor, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setPropertyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.sourceforge.pmd.lang.ast.AstVisitor
cannotVisitMethods inherited from interface net.sourceforge.pmd.lang.java.ast.JavaVisitor
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, visitMethods inherited from interface net.sourceforge.pmd.properties.PropertySource
definePropertyDescriptor, getOverriddenPropertiesByPropertyDescriptor, getOverriddenPropertyDescriptors, getPropertiesByPropertyDescriptor, getProperty, getPropertyDescriptor, getPropertyDescriptors, hasDescriptor, isPropertyOverridden, setPropertyMethods inherited from interface net.sourceforge.pmd.lang.rule.Rule
initialize
-
Constructor Details
-
ImplicitFunctionalInterfaceRule
public ImplicitFunctionalInterfaceRule()Default constructor.
-
-
Method Details
-
visit
-