Package edu.umd.cs.findbugs.detect
Class DumbMethods
- java.lang.Object
-
- All Implemented Interfaces:
Detector
,Priorities
,org.apache.bcel.classfile.Visitor
public class DumbMethods extends OpcodeStackDetector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
DumbMethods.BadCastInEqualsSubDetector
private class
DumbMethods.FutilePoolSizeSubDetector
private class
DumbMethods.InvalidMinMaxSubDetector
private class
DumbMethods.NullMethodsSubDetector
private class
DumbMethods.RandomOnceSubDetector
private class
DumbMethods.RangeCheckSubDetector
private class
DumbMethods.SubDetector
private class
DumbMethods.UrlCollectionSubDetector
private class
DumbMethods.VacuousComparisonSubDetector
-
Nested classes/interfaces inherited from class edu.umd.cs.findbugs.bcel.OpcodeStackDetector
OpcodeStackDetector.WithCustomJumpInfo
-
-
Field Summary
Fields Modifier and Type Field Description private BugAccumulator
absoluteValueAccumulator
private BugAccumulator
accumulator
private BugReporter
bugReporter
private boolean
checkForBitIorofSignedByte
private static java.lang.String
CLASS_NAME_RANDOM
private static org.apache.bcel.generic.ObjectType
CONDITION_TYPE
private boolean
ctorSeen
private org.apache.bcel.classfile.CodeException[]
exceptionTable
private BugInstance
gcInvocationBugReport
private int
gcInvocationPC
private boolean
isPublicStaticVoidMain
(package private) boolean
isSynthetic
private static int
MICROS_PER_DAY_OVERFLOWED_AS_INT
private static int
OOM_CATCH_LEN
A heuristic - how long a catch block for OutOfMemoryError might be.(package private) int
opcodesSincePendingAbsoluteValueBug
(package private) BugInstance
pendingAbsoluteValueBug
(package private) SourceLineAnnotation
pendingAbsoluteValueBugSourceLine
(package private) MethodDescriptor
previousMethodCall
private int
prevOpcode
private boolean
prevOpcodeWasReadLine
private java.lang.String
primitiveObjCtorSeen
private int
randomNextIntState
private int
sawCheckForNonNegativeSignedByte
private boolean
sawCurrentTimeMillis
(package private) boolean
sawLoadOfMinValue
private int
sinceBufferedInputStreamReady
private DumbMethods.SubDetector[]
subDetectors
private boolean
testingEnabled
-
Fields inherited from class edu.umd.cs.findbugs.bcel.OpcodeStackDetector
stack
-
Fields inherited from class edu.umd.cs.findbugs.visitclass.DismantleBytecode
codeBytes, lineNumberTable, M_BR, M_CP, M_INT, M_PAD, M_R, M_UINT
-
Fields inherited from interface edu.umd.cs.findbugs.Priorities
EXP_PRIORITY, HIGH_PRIORITY, IGNORE_PRIORITY, LOW_PRIORITY, NORMAL_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description DumbMethods(BugReporter bugReporter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkForCompatibleLongComparison(OpcodeStack.Item left, OpcodeStack.Item right)
private void
checkMonitorWait()
private void
flush()
Flush out cached state at the end of a method.private int
getStackEntryOfListCallThatMustBeNonnegative()
private boolean
isMonitorWait(java.lang.String name, java.lang.String sig)
static boolean
isTestMethod(org.apache.bcel.classfile.Method method)
private void
reportVacuousBitOperation(int seen, OpcodeStack.Item item)
void
sawOpcode(int seen)
By default, this method will not be called when stack is TOP.private int
stackEntryThatMustBeNonnegative(int seen)
Return index of stack entry that must be nonnegative.void
visit(org.apache.bcel.classfile.Code obj)
void
visit(org.apache.bcel.classfile.Field field)
void
visit(org.apache.bcel.classfile.JavaClass obj)
void
visit(org.apache.bcel.classfile.Method method)
void
visitAfter(org.apache.bcel.classfile.JavaClass obj)
-
Methods inherited from class edu.umd.cs.findbugs.bcel.OpcodeStackDetector
afterOpcode, beforeOpcode, getStack, isUsingCustomUserValue, visitCode
-
Methods inherited from class edu.umd.cs.findbugs.BytecodeScanningDetector
getClassContext, report, shouldVisitCode, visitClassContext
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.DismantleBytecode
areOppositeBranches, atCatchBlock, getBranchFallThrough, getBranchOffset, getBranchTarget, getClassConstantOperand, getClassDescriptorOperand, getCodeByte, getConstantRefOperand, getDefaultSwitchOffset, getDottedClassConstantOperand, getFieldDescriptorOperand, getIntConstant, getLongConstant, getMaxPC, getMethodDescriptorOperand, getNameConstantOperand, getNextCodeByte, getNextOpcode, getNextPC, getOpcode, getPC, getPrevOpcode, getRefConstantOperand, getRefFieldIsStatic, getRegisterOperand, getSigConstantOperand, getStringConstantOperand, getSwitchLabels, getSwitchOffsets, getXClassOperand, getXFieldOperand, getXMethodOperand, isBranch, isMethodCall, isRegisterLoad, isRegisterStore, isRegisterStore, isReturn, isShift, isSwitch, isWideOpcode, printOpCode, sawBranchTo, sawClass, sawDouble, sawField, sawFloat, sawIMethod, sawInt, sawLong, sawMethod, sawRegister, sawString
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.AnnotationVisitor
getAnnotationParameterAsString, getAnnotationParameterAsStringArray, visitAnnotation, visitAnnotation, visitParameterAnnotation, visitParameterAnnotation, visitSyntheticParameterAnnotation
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.PreorderVisitor
amVisitingMainMethod, asUnsignedByte, doVisitMethod, getClassDescriptor, getClassName, getCode, getConstantPool, getDottedClassName, getDottedFieldSig, getDottedMethodSig, getDottedSuperclassName, getField, getFieldDescriptor, getFieldIsStatic, getFieldName, getFieldSig, getFullyQualifiedFieldName, getFullyQualifiedMethodName, getMethod, getMethodDescriptor, getMethodName, getMethodSig, getMethodVisitOrder, getNumberArguments, getNumberMethodArguments, getPackageName, getSizeOfSurroundingTryBlock, getSizeOfSurroundingTryBlock, getSourceFile, getStringFromIndex, getSuperclassName, getSurroundingCaughtExceptions, getSurroundingCaughtExceptions, getSurroundingCaughtExceptionTypes, getSurroundingTryBlock, getSurroundingTryBlock, getThisClass, getXClass, getXField, getXMethod, hasInterestingClass, hasInterestingMethod, isVisitMethodsInCallOrder, setupVisitorForClass, setVisitMethodsInCallOrder, shouldVisit, toString, visitAfter, visitAnnotationDefault, visitAnnotationEntry, visitBootstrapMethods, visitConstantInvokeDynamic, visitConstantMethodHandle, visitConstantMethodType, visitConstantModule, visitConstantPackage, visitConstantPool, visitEnclosingMethod, visitingField, visitingMethod, visitInnerClasses, visitJavaClass, visitLineNumberTable, visitLocalVariableTable, visitMethodParameters, visitParameterAnnotationEntry, visitStackMap, visitStackMapEntry
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.BetterVisitor
clone, report, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visitCodeException, visitConstantClass, visitConstantDouble, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantLong, visitConstantMethodref, visitConstantNameAndType, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitExceptionTable, visitField, visitInnerClass, visitLineNumber, visitLocalVariable, visitLocalVariableTypeTable, visitMethod, visitSignature, visitSourceFile, visitSynthetic, visitUnknown
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.bcel.classfile.Visitor
visitConstantDynamic, visitMethodParameter, visitModule, visitModuleExports, visitModuleMainClass, visitModuleOpens, visitModulePackages, visitModuleProvides, visitModuleRequires, visitNestHost, visitNestMembers, visitRecord, visitRecordComponent, visitStackMapType
-
-
-
-
Field Detail
-
CLASS_NAME_RANDOM
@SlashedClassName private static final java.lang.String CLASS_NAME_RANDOM
- See Also:
- Constant Field Values
-
subDetectors
private final DumbMethods.SubDetector[] subDetectors
-
CONDITION_TYPE
private static final org.apache.bcel.generic.ObjectType CONDITION_TYPE
-
bugReporter
private final BugReporter bugReporter
-
sawCurrentTimeMillis
private boolean sawCurrentTimeMillis
-
gcInvocationBugReport
private BugInstance gcInvocationBugReport
-
gcInvocationPC
private int gcInvocationPC
-
exceptionTable
private org.apache.bcel.classfile.CodeException[] exceptionTable
-
primitiveObjCtorSeen
private java.lang.String primitiveObjCtorSeen
-
ctorSeen
private boolean ctorSeen
-
prevOpcodeWasReadLine
private boolean prevOpcodeWasReadLine
-
prevOpcode
private int prevOpcode
-
isPublicStaticVoidMain
private boolean isPublicStaticVoidMain
-
sawCheckForNonNegativeSignedByte
private int sawCheckForNonNegativeSignedByte
-
sinceBufferedInputStreamReady
private int sinceBufferedInputStreamReady
-
randomNextIntState
private int randomNextIntState
-
checkForBitIorofSignedByte
private boolean checkForBitIorofSignedByte
-
OOM_CATCH_LEN
private static final int OOM_CATCH_LEN
A heuristic - how long a catch block for OutOfMemoryError might be.- See Also:
- Constant Field Values
-
testingEnabled
private final boolean testingEnabled
-
accumulator
private final BugAccumulator accumulator
-
absoluteValueAccumulator
private final BugAccumulator absoluteValueAccumulator
-
MICROS_PER_DAY_OVERFLOWED_AS_INT
private static final int MICROS_PER_DAY_OVERFLOWED_AS_INT
- See Also:
- Constant Field Values
-
isSynthetic
boolean isSynthetic
-
opcodesSincePendingAbsoluteValueBug
int opcodesSincePendingAbsoluteValueBug
-
pendingAbsoluteValueBug
BugInstance pendingAbsoluteValueBug
-
pendingAbsoluteValueBugSourceLine
SourceLineAnnotation pendingAbsoluteValueBugSourceLine
-
sawLoadOfMinValue
boolean sawLoadOfMinValue
-
previousMethodCall
MethodDescriptor previousMethodCall
-
-
Constructor Detail
-
DumbMethods
public DumbMethods(BugReporter bugReporter)
-
-
Method Detail
-
visit
public void visit(org.apache.bcel.classfile.JavaClass obj)
- Overrides:
visit
in classBetterVisitor
-
visitAfter
public void visitAfter(org.apache.bcel.classfile.JavaClass obj)
- Overrides:
visitAfter
in classPreorderVisitor
-
isTestMethod
public static boolean isTestMethod(org.apache.bcel.classfile.Method method)
-
visit
public void visit(org.apache.bcel.classfile.Field field)
- Overrides:
visit
in classBetterVisitor
-
visit
public void visit(org.apache.bcel.classfile.Method method)
- Overrides:
visit
in classBetterVisitor
-
sawOpcode
public void sawOpcode(int seen)
Description copied from class:OpcodeStackDetector
By default, this method will not be called when stack is TOP. To change this behavior, override
#beforeOpcode(int)
and change to return true even if stack is TOP.see Using FindBugs for Research to learn lattice and what TOP means.
- Specified by:
sawOpcode
in classOpcodeStackDetector
- See Also:
OpcodeStackDetector.beforeOpcode(int)
-
checkForCompatibleLongComparison
private void checkForCompatibleLongComparison(OpcodeStack.Item left, OpcodeStack.Item right)
-
reportVacuousBitOperation
private void reportVacuousBitOperation(int seen, OpcodeStack.Item item)
- Parameters:
seen
-item
-
-
stackEntryThatMustBeNonnegative
private int stackEntryThatMustBeNonnegative(int seen)
Return index of stack entry that must be nonnegative. Return -1 if no stack entry is required to be nonnegative.
-
getStackEntryOfListCallThatMustBeNonnegative
private int getStackEntryOfListCallThatMustBeNonnegative()
-
checkMonitorWait
private void checkMonitorWait()
-
isMonitorWait
private boolean isMonitorWait(java.lang.String name, java.lang.String sig)
-
visit
public void visit(org.apache.bcel.classfile.Code obj)
- Overrides:
visit
in classDismantleBytecode
-
flush
private void flush()
Flush out cached state at the end of a method.
-
-