Class 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  
      • 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

      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/signatures
      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.
      void report()
      required for implementing the interface
      java.lang.String toString()  
      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 Detail

      • OBJECT_METHODS

        private static final java.util.Set<QMethod> OBJECT_METHODS
      • bugReporter

        private final edu.umd.cs.findbugs.BugReporter bugReporter
    • Constructor Detail

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

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object