Package edu.umd.cs.findbugs.detect
Class FindHiddenMethod
- java.lang.Object
-
- edu.umd.cs.findbugs.detect.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
-
-
Field Summary
Fields Modifier and Type Field Description private BugReporter
bugReporter
-
Fields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description FindHiddenMethod(BugReporter bugReporter)
-
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 Constructorsprivate 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 arrayvoid
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.
-
-
-
Field Detail
-
bugReporter
private final BugReporter bugReporter
-
-
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 interfaceDetector
- 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.
-
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
-
-