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
Modifier and TypeClassDescriptionstatic @interface
You 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 class
static class
static class
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
static String
getExceptionSig
(DismantleBytecode dbc, org.apache.bcel.classfile.CodeException e) int
getLastUpdate
(int reg) getLVValue
(int index) int
int
int
getStackItem
(int stackOffset) boolean
hasIncomingBranches
(int pc) void
protected boolean
boolean
isJumpTarget
(int pc) boolean
isTop()
void
void
void
void
void
replace
(int stackOffset, OpcodeStack.Item value) void
replaceTop
(OpcodeStack.Item newTop) int
resetForMethodEntry
(DismantleBytecode visitor) void
sawOpcode
(DismantleBytecode dbc, int seen) void
setJumpInfoChangedByBackwardBranch
(String kind, int from, int to) protected void
toString()
-
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()
-