Class FindHiddenMethod

  • All Implemented Interfaces:
    Detector, Priorities

    public class FindHiddenMethod
    extends java.lang.Object
    implements Detector
    This detector finds all the methods of a subclass which are hiding the static methods of the superclass. Please see @see SEI CERT MET07-J
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean isAutoGeneratedMethod​(org.apache.bcel.classfile.Method method)
      This method checks for the autoGenerated methods for an inner class - exceptional cases.
      private boolean isConstructor​(org.apache.bcel.classfile.Method method)
      This method is here to check the exceptional case of Constructors
      private boolean isHidingInnerClass​(org.apache.bcel.classfile.Method method)
      This method checks for the inner class exceptional cases.
      private boolean isMainMethod​(org.apache.bcel.classfile.Method method)
      This method checks for the exceptional case of main method.
      private boolean isStringArray​(org.apache.bcel.generic.Type[] methodArguments)
      This method checks whether the argument is String array
      void report()
      This method is called after all classes to be visited.
      void visitClassContext​(ClassContext classContext)
      Visit the ClassContext for a class which should be analyzed for instances of bug patterns.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

    • Constructor Detail

      • FindHiddenMethod

        public FindHiddenMethod​(BugReporter bugReporter)
    • Method Detail

      • visitClassContext

        public void visitClassContext​(ClassContext classContext)
        Description copied from interface: Detector
        Visit the ClassContext for a class which should be analyzed for instances of bug patterns.
        Specified by:
        visitClassContext in interface Detector
        Parameters:
        classContext - the ClassContext
      • report

        public void report()
        Description copied from interface: Detector
        This method is called after all classes to be visited. It should be used by any detectors which accumulate information over all visited classes to generate results.
        Specified by:
        report in interface Detector
      • isHidingInnerClass

        private boolean isHidingInnerClass​(org.apache.bcel.classfile.Method method)
        This method checks for the inner class exceptional cases. As whenever there an inner class, '.access$' methods are created hiddenly to access the outer class attributes.
      • isAutoGeneratedMethod

        private boolean isAutoGeneratedMethod​(org.apache.bcel.classfile.Method method)
        This method checks for the autoGenerated methods for an inner class - exceptional cases. As whenever there an inner class, '.class$' methods are created hiddenly.
      • isConstructor

        private boolean isConstructor​(org.apache.bcel.classfile.Method method)
        This method is here to check the exceptional case of Constructors
      • isMainMethod

        private boolean isMainMethod​(org.apache.bcel.classfile.Method method)
        This method checks for the exceptional case of main method. As we know main method always have the signature "public static void main(String[] args)". It is static but usually public class have its own main method as its entry point. Therefore, it is not an error caused by Programming but a utility to provide UI to user. This condition is to abide with the latest main method criteria. @see JEP 445
      • isStringArray

        private boolean isStringArray​(org.apache.bcel.generic.Type[] methodArguments)
        This method checks whether the argument is String array