Package edu.umd.cs.findbugs.detect
Class FindHEmismatch
- java.lang.Object
-
- All Implemented Interfaces:
Detector,Priorities,StatelessDetector,java.lang.Cloneable,org.apache.bcel.classfile.Visitor
public class FindHEmismatch extends OpcodeStackDetector implements StatelessDetector
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFindHEmismatch.PotentialBugKey-
Nested classes/interfaces inherited from class edu.umd.cs.findbugs.bcel.OpcodeStackDetector
OpcodeStackDetector.WithCustomJumpInfo
-
-
Field Summary
Fields Modifier and Type Field Description private BugReporterbugReporter(package private) MethodAnnotationcompareToMethod(package private) MethodAnnotationcompareToObjectMethod(package private) MethodAnnotationcompareToSelfMethod(package private) MethodAnnotationequalsMethod(package private) booleanequalsMethodIsInstanceOfEquals(package private) booleanequalsObjectIsAbstract(package private) ClassDescriptorequalsOtherClass(package private) MethodAnnotationequalsOtherMethod(package private) booleanextendsObject(package private) booleanhasCompareToBridgeMethod(package private) booleanhasCompareToObject(package private) booleanhasCompareToSelf(package private) booleanhasEqualsObject(package private) booleanhasEqualsOther(package private) booleanhasEqualsSelf(package private) booleanhasFields(package private) booleanhasHashCode(package private) booleanhashCodeIsAbstract(package private) MethodAnnotationhashCodeMethod(package private) static java.util.regex.PatternhashTablePattern(package private) booleanisApplicationClass(package private) static java.util.regex.PatternmapPattern(package private) java.util.HashSet<java.lang.String>nonHashableClasses(package private) java.util.Map<FindHEmismatch.PotentialBugKey,BugInstance>potentialBugs(package private) static java.util.regex.PatternpredicateOverAnInstance(package private) static java.util.regex.PatternsetPattern(package private) booleanvisibleOutsidePackage-
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 FindHEmismatch(BugReporter bugReporter)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidcheck(int pos)(package private) java.lang.StringfindHashedClassInSignature(java.lang.String sig)(package private) org.apache.bcel.classfile.MethodfindMethod(org.apache.bcel.classfile.JavaClass clazz, java.lang.String name, java.lang.String sig)booleanisHashableClassName(java.lang.String dottedClassName)static intopcode(byte[] code, int offset)voidreport()This method is called after all classes to be visited.voidsawOpcode(int seen)By default, this method will not be called when stack is TOP.booleanshouldVisitCode(org.apache.bcel.classfile.Code obj)Check see if the Code for this method should be visited.voidvisit(org.apache.bcel.classfile.Field obj)voidvisit(org.apache.bcel.classfile.JavaClass obj)voidvisit(org.apache.bcel.classfile.Method obj)voidvisit(org.apache.bcel.classfile.Signature obj)voidvisitAfter(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, 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, visit
-
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, 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, 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
-
mapPattern
static final java.util.regex.Pattern mapPattern
-
hashTablePattern
static final java.util.regex.Pattern hashTablePattern
-
setPattern
static final java.util.regex.Pattern setPattern
-
predicateOverAnInstance
static final java.util.regex.Pattern predicateOverAnInstance
-
isApplicationClass
boolean isApplicationClass
-
hasFields
boolean hasFields
-
visibleOutsidePackage
boolean visibleOutsidePackage
-
hasHashCode
boolean hasHashCode
-
hasEqualsObject
boolean hasEqualsObject
-
hashCodeIsAbstract
boolean hashCodeIsAbstract
-
equalsObjectIsAbstract
boolean equalsObjectIsAbstract
-
equalsMethodIsInstanceOfEquals
boolean equalsMethodIsInstanceOfEquals
-
hasCompareToObject
boolean hasCompareToObject
-
hasCompareToBridgeMethod
boolean hasCompareToBridgeMethod
-
hasEqualsSelf
boolean hasEqualsSelf
-
hasEqualsOther
boolean hasEqualsOther
-
hasCompareToSelf
boolean hasCompareToSelf
-
extendsObject
boolean extendsObject
-
equalsMethod
MethodAnnotation equalsMethod
-
equalsOtherMethod
MethodAnnotation equalsOtherMethod
-
equalsOtherClass
ClassDescriptor equalsOtherClass
-
compareToMethod
MethodAnnotation compareToMethod
-
compareToObjectMethod
MethodAnnotation compareToObjectMethod
-
compareToSelfMethod
MethodAnnotation compareToSelfMethod
-
hashCodeMethod
MethodAnnotation hashCodeMethod
-
nonHashableClasses
final java.util.HashSet<java.lang.String> nonHashableClasses
-
potentialBugs
final java.util.Map<FindHEmismatch.PotentialBugKey,BugInstance> potentialBugs
-
bugReporter
private final BugReporter bugReporter
-
-
Constructor Detail
-
FindHEmismatch
public FindHEmismatch(BugReporter bugReporter)
-
-
Method Detail
-
isHashableClassName
public boolean isHashableClassName(java.lang.String dottedClassName)
-
visitAfter
public void visitAfter(org.apache.bcel.classfile.JavaClass obj)
- Overrides:
visitAfterin classPreorderVisitor
-
visit
public void visit(org.apache.bcel.classfile.JavaClass obj)
- Overrides:
visitin classBetterVisitor
-
shouldVisitCode
public boolean shouldVisitCode(org.apache.bcel.classfile.Code obj)
Description copied from class:BytecodeScanningDetectorCheck see if the Code for this method should be visited.- Overrides:
shouldVisitCodein classBytecodeScanningDetector- Parameters:
obj- Code attribute- Returns:
- true if the Code should be visited
-
opcode
public static int opcode(byte[] code, int offset)
-
visit
public void visit(org.apache.bcel.classfile.Field obj)
- Overrides:
visitin classBetterVisitor
-
visit
public void visit(org.apache.bcel.classfile.Method obj)
- Overrides:
visitin classBetterVisitor
-
findMethod
org.apache.bcel.classfile.Method findMethod(org.apache.bcel.classfile.JavaClass clazz, java.lang.String name, java.lang.String sig)
-
sawOpcode
public void sawOpcode(int seen)
Description copied from class:OpcodeStackDetectorBy 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:
sawOpcodein classOpcodeStackDetector- See Also:
OpcodeStackDetector.beforeOpcode(int)
-
check
private void check(int pos)
-
findHashedClassInSignature
@CheckForNull @DottedClassName java.lang.String findHashedClassInSignature(java.lang.String sig)
-
visit
public void visit(org.apache.bcel.classfile.Signature obj)
- Overrides:
visitin classBetterVisitor
-
report
public void report()
Description copied from interface:DetectorThis 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:
reportin interfaceDetector- Overrides:
reportin classBytecodeScanningDetector
-
-