Package edu.umd.cs.findbugs
Class OpcodeStack
java.lang.Object
edu.umd.cs.findbugs.OpcodeStack
tracks the types and numbers of objects that are currently on the operand
stack throughout the execution of method. To use, a detector should
instantiate one for each method, and call
stack.sawOpcode(this,seen);
at the bottom of their sawOpcode method. at any point you can then inspect the stack and see what the types of objects are on the stack, including constant values if they were pushed. The types described are of course, only the static types. There are some outstanding opcodes that have yet to be implemented, I couldn't find any code that actually generated these, so i didn't put them in because I couldn't test them:- dup2_x2
- jsr_w
- wide
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceYou can put this annotation on a OpcodeStack detector to indicate that it usesOpcodeStack.Item.userValue, and thus should not reuse generic OpcodeStack information from an iterative evaluation of the opcode stack.static classstatic classstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()static StringgetExceptionSig(DismantleBytecode dbc, org.apache.bcel.classfile.CodeException e) intgetLastUpdate(int reg) getLVValue(int index) intintintgetStackItem(int stackOffset) booleanhasIncomingBranches(int pc) voidprotected booleanbooleanisJumpTarget(int pc) booleanisTop()voidvoidvoidvoidvoidreplace(int stackOffset, OpcodeStack.Item value) voidreplaceTop(OpcodeStack.Item newTop) intresetForMethodEntry(DismantleBytecode visitor) voidsawOpcode(DismantleBytecode dbc, int seen) voidsetJumpInfoChangedByBackwardBranch(String kind, int from, int to) protected voidtoString()
-
Constructor Details
-
OpcodeStack
public OpcodeStack()
-
-
Method Details
-
toString
-
hasIncomingBranches
public boolean hasIncomingBranches(int pc) -
getExceptionSig
public static String getExceptionSig(DismantleBytecode dbc, org.apache.bcel.classfile.CodeException e) -
mergeJumps
-
getLastUpdate
public int getLastUpdate(int reg) -
getNumLastUpdates
public int getNumLastUpdates() -
sawOpcode
-
precomputation
-
clear
public void clear() -
printJumpEntries
public void printJumpEntries() -
isJumpTarget
public boolean isJumpTarget(int pc) -
learnFrom
-
initialize
public void initialize() -
resetForMethodEntry
-
setJumpInfoChangedByBackwardBranch
-
getStackDepth
public int getStackDepth() -
getStackItem
-
replace
-
replaceTop
-
getItemMethodInvokedOn
-
getLVValue
-
getNumLocalValues
public int getNumLocalValues() -
isTop
public boolean isTop() -
isJumpInfoChangedByNewTarget
protected boolean isJumpInfoChangedByNewTarget()- Returns:
- Returns the jumpInfoChangedByNewTarget.
-
setJumpInfoChangedByNewTarget
protected void setJumpInfoChangedByNewTarget()
-