Package edu.umd.cs.findbugs.visitclass
Class DismantleBytecode
java.lang.Object
edu.umd.cs.findbugs.visitclass.BetterVisitor
edu.umd.cs.findbugs.visitclass.PreorderVisitor
edu.umd.cs.findbugs.visitclass.AnnotationVisitor
edu.umd.cs.findbugs.visitclass.DismantleBytecode
- All Implemented Interfaces:
org.apache.bcel.classfile.Visitor
- Direct Known Subclasses:
BytecodeScanningDetector
,CloneIdiom
,NoteDirectlyRelevantTypeQualifiers
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]
protected org.apache.bcel.classfile.LineNumberTable
static final byte
static final byte
static final byte
Meaning of bytecode operandsstatic final byte
static final byte
static final byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
afterOpcode
(int seen) static boolean
areOppositeBranches
(int opcode1, int opcode2) boolean
boolean
beforeOpcode
(int seen) return false if we should skip calling sawOpcodeint
int
int
If the current opcode has a class constant operand, get the classname, slash-formatted.int
getCodeByte
(int offset) org.apache.bcel.classfile.Constant
int
If the current opcode has a class operand, get the associated class constant, dot-formattedint
long
int
getMaxPC()
If the current opcode has a reference constant operand, get its nameint
getNextCodeByte
(int offset) int
int
int
int
getPC()
int
getPrevOpcode
(int offset) return previous opcode;Deprecated.boolean
int
If the current opcode has a reference constant operand, get its signature, slash-formattedIf the current opcode has a string constant operand, get its nameint[]
int[]
static boolean
isBranch
(int opcode) Return whether or not given opcode is a branch instruction.boolean
boolean
boolean
boolean
isRegisterStore
(int opcode) boolean
isReturn
(int opcode) boolean
isShift
(int opcode) static boolean
isSwitch
(int opcode) Return whether or not given opcode is a switch instruction.boolean
void
printOpCode
(int seen) void
sawBranchTo
(int targetPC) void
sawClass()
void
sawDouble
(double seen) void
sawField()
void
sawFloat
(float seen) void
void
sawInt
(int seen) void
sawLong
(long seen) void
void
sawOpcode
(int seen) void
sawRegister
(int r) void
void
visit
(org.apache.bcel.classfile.Code obj) 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, 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 Details
-
M_INT
public static final byte M_INTMeaning of bytecode operands- See Also:
-
M_UINT
public static final byte M_UINT- See Also:
-
M_CP
public static final byte M_CP- See Also:
-
M_R
public static final byte M_R- See Also:
-
M_BR
public static final byte M_BR- See Also:
-
M_PAD
public static final byte M_PAD- See Also:
-
codeBytes
protected byte[] codeBytes -
lineNumberTable
protected org.apache.bcel.classfile.LineNumberTable lineNumberTable
-
-
Constructor Details
-
DismantleBytecode
public DismantleBytecode()
-
-
Method Details
-
getClassDescriptorOperand
-
getXClassOperand
-
isMethodCall
public boolean isMethodCall() -
getMethodDescriptorOperand
-
getXMethodOperand
-
getFieldDescriptorOperand
-
getXFieldOperand
-
getDottedClassConstantOperand
If the current opcode has a class operand, get the associated class constant, dot-formatted -
getRefConstantOperand
Deprecated.If the current opcode has a reference constant operand, get its string representation -
getNameConstantOperand
If the current opcode has a reference constant operand, get its name -
getSigConstantOperand
If the current opcode has a reference constant operand, get its signature, slash-formatted -
getClassConstantOperand
If the current opcode has a class constant operand, get the classname, slash-formatted. -
getStringConstantOperand
If the current opcode has a string constant operand, get its name -
getConstantRefOperand
public org.apache.bcel.classfile.Constant getConstantRefOperand() -
isRegisterLoad
public boolean isRegisterLoad() -
isRegisterStore
public boolean isRegisterStore() -
getRegisterOperand
public int getRegisterOperand() -
getIntConstant
public int getIntConstant() -
getLongConstant
public long getLongConstant() -
getBranchOffset
public int getBranchOffset() -
getBranchTarget
public int getBranchTarget() -
getBranchFallThrough
public int getBranchFallThrough() -
getDefaultSwitchOffset
public int getDefaultSwitchOffset() -
getRefFieldIsStatic
public boolean getRefFieldIsStatic() -
getPC
public int getPC() -
getPrevOpcode
public int getPrevOpcode(int offset) return previous opcode;- Parameters:
offset
- 0 for current opcode, 1 for one before that, etc.
-
isWideOpcode
public boolean isWideOpcode() -
isBranch
public static boolean isBranch(int opcode) Return whether or not given opcode is a branch instruction.- Parameters:
opcode
- the opcode- Returns:
- true if instruction is a branch, false if not
-
isSwitch
public static boolean isSwitch(int opcode) Return whether or not given opcode is a switch instruction.- Parameters:
opcode
- the opcode- Returns:
- true if instruction is a switch, false if not
-
getSwitchOffsets
public int[] getSwitchOffsets() -
getSwitchLabels
public int[] getSwitchLabels() -
getMaxPC
public int getMaxPC() -
getCodeByte
public int getCodeByte(int offset) -
getOpcode
public int getOpcode() -
atCatchBlock
public boolean atCatchBlock() -
visit
public void visit(org.apache.bcel.classfile.Code obj) - Overrides:
visit
in classBetterVisitor
-
sawDouble
public void sawDouble(double seen) -
sawFloat
public void sawFloat(float seen) -
sawRegister
public void sawRegister(int r) -
sawInt
public void sawInt(int seen) -
sawLong
public void sawLong(long seen) -
sawBranchTo
public void sawBranchTo(int targetPC) -
beforeOpcode
public boolean beforeOpcode(int seen) return false if we should skip calling sawOpcode -
afterOpcode
public void afterOpcode(int seen) -
sawOpcode
public void sawOpcode(int seen) -
sawString
-
sawField
public void sawField() -
sawMethod
public void sawMethod() -
sawIMethod
public void sawIMethod() -
sawClass
public void sawClass() -
printOpCode
public void printOpCode(int seen) -
getNextPC
public int getNextPC()- Returns:
- Returns the nextPC.
-
getNextOpcode
public int getNextOpcode() -
getNextCodeByte
public int getNextCodeByte(int offset) -
isReturn
public boolean isReturn(int opcode) -
isShift
public boolean isShift(int opcode) -
areOppositeBranches
public static boolean areOppositeBranches(int opcode1, int opcode2) -
isRegisterStore
public boolean isRegisterStore(int opcode)
-