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 class
FindHEmismatch.PotentialBugKey
-
Nested classes/interfaces inherited from class edu.umd.cs.findbugs.bcel.OpcodeStackDetector
OpcodeStackDetector.WithCustomJumpInfo
-
-
Field Summary
Fields Modifier and Type Field Description private BugReporter
bugReporter
(package private) MethodAnnotation
compareToMethod
(package private) MethodAnnotation
compareToObjectMethod
(package private) MethodAnnotation
compareToSelfMethod
(package private) MethodAnnotation
equalsMethod
(package private) boolean
equalsMethodIsInstanceOfEquals
(package private) boolean
equalsObjectIsAbstract
(package private) ClassDescriptor
equalsOtherClass
(package private) MethodAnnotation
equalsOtherMethod
(package private) boolean
extendsObject
(package private) boolean
hasCompareToBridgeMethod
(package private) boolean
hasCompareToObject
(package private) boolean
hasCompareToSelf
(package private) boolean
hasEqualsObject
(package private) boolean
hasEqualsOther
(package private) boolean
hasEqualsSelf
(package private) boolean
hasFields
(package private) boolean
hasHashCode
(package private) boolean
hashCodeIsAbstract
(package private) MethodAnnotation
hashCodeMethod
(package private) static java.util.regex.Pattern
hashTablePattern
(package private) boolean
isApplicationClass
(package private) static java.util.regex.Pattern
mapPattern
(package private) java.util.HashSet<java.lang.String>
nonHashableClasses
(package private) java.util.Map<FindHEmismatch.PotentialBugKey,BugInstance>
potentialBugs
(package private) static java.util.regex.Pattern
predicateOverAnInstance
(package private) static java.util.regex.Pattern
setPattern
(package private) boolean
visibleOutsidePackage
-
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 void
check(int pos)
(package private) java.lang.String
findHashedClassInSignature(java.lang.String sig)
(package private) org.apache.bcel.classfile.Method
findMethod(org.apache.bcel.classfile.JavaClass clazz, java.lang.String name, java.lang.String sig)
boolean
isHashableClassName(java.lang.String dottedClassName)
static int
opcode(byte[] code, int offset)
void
report()
This method is called after all classes to be visited.void
sawOpcode(int seen)
By default, this method will not be called when stack is TOP.boolean
shouldVisitCode(org.apache.bcel.classfile.Code obj)
Check see if the Code for this method should be visited.void
visit(org.apache.bcel.classfile.Field obj)
void
visit(org.apache.bcel.classfile.JavaClass obj)
void
visit(org.apache.bcel.classfile.Method obj)
void
visit(org.apache.bcel.classfile.Signature obj)
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, 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
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:
visitAfter
in classPreorderVisitor
-
visit
public void visit(org.apache.bcel.classfile.JavaClass obj)
- Overrides:
visit
in classBetterVisitor
-
shouldVisitCode
public boolean shouldVisitCode(org.apache.bcel.classfile.Code obj)
Description copied from class:BytecodeScanningDetector
Check see if the Code for this method should be visited.- Overrides:
shouldVisitCode
in 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:
visit
in classBetterVisitor
-
visit
public void visit(org.apache.bcel.classfile.Method obj)
- Overrides:
visit
in 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: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)
-
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:
visit
in classBetterVisitor
-
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 interfaceDetector
- Overrides:
report
in classBytecodeScanningDetector
-
-