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 java.lang.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
Fields Modifier and Type Field Description private edu.umd.cs.findbugs.BugReporter
bugReporter
private static java.util.Set<QMethod>
OBJECT_METHODS
-
Constructor Summary
Constructors Constructor Description SpoiledChildInterfaceImplementor(edu.umd.cs.findbugs.BugReporter bugReporter)
constructs a SCII detector given the reporter to report bugs on
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.Set<QMethod>
buildMethodSet(org.apache.bcel.classfile.JavaClass cls)
builds a set of all non constructor or static initializer method/signaturesprivate void
filterSuperInterfaceMethods(org.apache.bcel.classfile.JavaClass inf, java.util.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.void
report()
required for implementing the interfacejava.lang.String
toString()
void
visitClassContext(edu.umd.cs.findbugs.ba.ClassContext classContext)
looks for classes that implement interfaces but don't provide those methods
-
-
-
Field Detail
-
OBJECT_METHODS
private static final java.util.Set<QMethod> OBJECT_METHODS
-
bugReporter
private final edu.umd.cs.findbugs.BugReporter bugReporter
-
-
Method Detail
-
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:
visitClassContext
in 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:
report
in interfaceedu.umd.cs.findbugs.Detector
-
buildMethodSet
private static java.util.Set<QMethod> buildMethodSet(org.apache.bcel.classfile.JavaClass cls)
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, java.util.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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-