Package com.mebigfatguy.fbcontrib.detect
Class SpoiledChildInterfaceImplementor
java.lang.Object
com.mebigfatguy.fbcontrib.detect.SpoiledChildInterfaceImplementor
- All Implemented Interfaces:
edu.umd.cs.findbugs.Detector,edu.umd.cs.findbugs.Priorities
public class SpoiledChildInterfaceImplementor
extends Object
implements edu.umd.cs.findbugs.Detector
looks for classes that implement interfaces by relying on methods being
implemented in super classes, even though the superclass knows nothing about
the interface being implemented by the child.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final edu.umd.cs.findbugs.BugReporterFields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionSpoiledChildInterfaceImplementor(edu.umd.cs.findbugs.BugReporter bugReporter) constructs a SCII detector given the reporter to report bugs on -
Method Summary
Modifier and TypeMethodDescriptionbuildMethodSet(org.apache.bcel.classfile.JavaClass cls) builds a set of all non constructor or static initializer method/signaturesprivate voidfilterSuperInterfaceMethods(org.apache.bcel.classfile.JavaClass inf, Set<QMethod> infMethods, org.apache.bcel.classfile.JavaClass cls) removes methods found in an interface when a super interface having the same methods is implemented in a parent.voidreport()required for implementing the interfacetoString()voidvisitClassContext(edu.umd.cs.findbugs.ba.ClassContext classContext) looks for classes that implement interfaces but don't provide those methods
-
Field Details
-
IGNORED_SUPERCLASSES
-
OBJECT_METHODS
-
bugReporter
private final edu.umd.cs.findbugs.BugReporter bugReporter
-
-
Constructor Details
-
SpoiledChildInterfaceImplementor
public SpoiledChildInterfaceImplementor(edu.umd.cs.findbugs.BugReporter bugReporter) constructs a SCII detector given the reporter to report bugs on- Parameters:
bugReporter- the sync of bug reports
-
-
Method Details
-
visitClassContext
public void visitClassContext(edu.umd.cs.findbugs.ba.ClassContext classContext) looks for classes that implement interfaces but don't provide those methods- Specified by:
visitClassContextin interfaceedu.umd.cs.findbugs.Detector- Parameters:
classContext- the context object of the currently parsed class
-
report
public void report()required for implementing the interface- Specified by:
reportin interfaceedu.umd.cs.findbugs.Detector
-
buildMethodSet
builds a set of all non constructor or static initializer method/signatures- Parameters:
cls- the class to build the method set from- Returns:
- a set of method names/signatures
-
filterSuperInterfaceMethods
private void filterSuperInterfaceMethods(org.apache.bcel.classfile.JavaClass inf, Set<QMethod> infMethods, org.apache.bcel.classfile.JavaClass cls) removes methods found in an interface when a super interface having the same methods is implemented in a parent. While this is somewhat hinky, we'll allow it.- Parameters:
inf- the interface to look for super interfaces forinfMethods- the remaining methods that are needed to be foundcls- the super class to look for these methods in
-
toString
-