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

    Fields
    Modifier and Type
    Field
    Description
    private final edu.umd.cs.findbugs.BugReporter
     
    private static final Set<String>
     
    private static final Set<QMethod>
     

    Fields inherited from interface edu.umd.cs.findbugs.Priorities

    EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
  • 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

    Modifier and Type
    Method
    Description
    private static Set<QMethod>
    buildMethodSet(org.apache.bcel.classfile.JavaClass cls)
    builds a set of all non constructor or static initializer method/signatures
    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.
    void
    required for implementing the interface
     
    void
    visitClassContext(edu.umd.cs.findbugs.ba.ClassContext classContext)
    looks for classes that implement interfaces but don't provide those methods

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • IGNORED_SUPERCLASSES

      private static final Set<String> IGNORED_SUPERCLASSES
    • OBJECT_METHODS

      private static final Set<QMethod> 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:
      visitClassContext in interface edu.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 interface edu.umd.cs.findbugs.Detector
    • buildMethodSet

      private static 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, 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 for
      infMethods - the remaining methods that are needed to be found
      cls - the super class to look for these methods in
    • toString

      public String toString()
      Overrides:
      toString in class Object