Package edu.umd.cs.findbugs.detect
Class WrongMapIterator
- java.lang.Object
-
- All Implemented Interfaces:
Detector,Priorities,StatelessDetector,java.lang.Cloneable,org.apache.bcel.classfile.Visitor
public class WrongMapIterator extends BytecodeScanningDetector implements StatelessDetector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classWrongMapIterator.LoadedVariable(package private) static classWrongMapIterator.LoadedVariableState
-
Field Summary
Fields Modifier and Type Field Description private BugAccumulatorbugAccumulatorprivate static intIN_STACKprivate intiteratorRegisterprivate intkeyRegisterprivate intkeySetRegisterprivate WrongMapIterator.LoadedVariableloadedVariableprivate booleanmapAndKeyLoadedprivate WrongMapIterator.LoadedVariablemapVariableprivate static java.util.Set<MethodDescriptor>methods(package private) WrongMapIterator.LoadedVariableNONEprivate static intNOT_FOUND-
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 WrongMapIterator(BugReporter bugReporter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidhandleStore(int register)private inthandleStore(int storeRegister, int current)private static booleanimplementsMap(ClassDescriptor d)Determine from the class descriptor for a variable whether that variable implements java.util.Map.private voidremovedFromStack(boolean includeKey)private voidreset()voidsawOpcode(int seen)voidvisit(org.apache.bcel.classfile.Code code)voidvisit(org.apache.bcel.classfile.Method obj)voidvisitClassContext(ClassContext classContext)Visit the ClassContext for a class which should be analyzed for instances of bug patterns.-
Methods inherited from class edu.umd.cs.findbugs.BytecodeScanningDetector
getClassContext, report, shouldVisitCode
-
Methods inherited from class edu.umd.cs.findbugs.visitclass.DismantleBytecode
afterOpcode, areOppositeBranches, atCatchBlock, beforeOpcode, 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
getAnnotationParameterAsEnum, 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, visitAfter, visitAnnotationDefault, visitAnnotationEntry, visitBootstrapMethods, visitCode, 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, 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 edu.umd.cs.findbugs.StatelessDetector
clone
-
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
-
methods
private static final java.util.Set<MethodDescriptor> methods
-
NONE
final WrongMapIterator.LoadedVariable NONE
-
bugAccumulator
private final BugAccumulator bugAccumulator
-
NOT_FOUND
private static final int NOT_FOUND
- See Also:
- Constant Field Values
-
IN_STACK
private static final int IN_STACK
- See Also:
- Constant Field Values
-
loadedVariable
private WrongMapIterator.LoadedVariable loadedVariable
-
mapVariable
private WrongMapIterator.LoadedVariable mapVariable
-
keySetRegister
private int keySetRegister
-
iteratorRegister
private int iteratorRegister
-
keyRegister
private int keyRegister
-
mapAndKeyLoaded
private boolean mapAndKeyLoaded
-
-
Constructor Detail
-
WrongMapIterator
public WrongMapIterator(BugReporter bugReporter)
-
-
Method Detail
-
visitClassContext
public void visitClassContext(ClassContext classContext)
Description copied from interface:DetectorVisit the ClassContext for a class which should be analyzed for instances of bug patterns.- Specified by:
visitClassContextin interfaceDetector- Overrides:
visitClassContextin classBytecodeScanningDetector- Parameters:
classContext- the ClassContext
-
visit
public void visit(org.apache.bcel.classfile.Method obj)
- Overrides:
visitin classBetterVisitor
-
reset
private void reset()
-
visit
public void visit(org.apache.bcel.classfile.Code code)
- Overrides:
visitin classDismantleBytecode
-
implementsMap
private static boolean implementsMap(ClassDescriptor d)
Determine from the class descriptor for a variable whether that variable implements java.util.Map.- Parameters:
d- class descriptor for variable we want to check implements Map- Returns:
- true iff the descriptor corresponds to an implementor of Map
-
handleStore
private int handleStore(int storeRegister, int current)
-
handleStore
private void handleStore(int register)
-
removedFromStack
private void removedFromStack(boolean includeKey)
-
sawOpcode
public void sawOpcode(int seen)
- Overrides:
sawOpcodein classDismantleBytecode
-
-