Package com.mebigfatguy.fbcontrib.utils
Class TernaryPatcher
- java.lang.Object
-
- com.mebigfatguy.fbcontrib.utils.TernaryPatcher
-
public final class TernaryPatcher extends java.lang.Object
restores OpcodeStack Item's userValues when a ternary is processed. This class is required because Findbugs has a bug whereby it strips the user value field from all OpcodeStack items when a GOTO is processed when items are on the stack. Normally this is not the case, but in the case of ternary handling there may be N items on the stack before what the ternary pushes. Now clearly the uservalue should be stripped for items pushed on by both branches of the ternary, but items that were on the stack before the ternary was executed should be left alone. This is currently not happening in findbugs. So this class saves off user values across a GOTO involved with a ternary and restores them appropriately.
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
sawGOTO
private static java.util.List<java.lang.Object>
userValues
-
Constructor Summary
Constructors Modifier Constructor Description private
TernaryPatcher()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
post(edu.umd.cs.findbugs.OpcodeStack stack, int opcode)
called after the execution of the parent OpcodeStack.sawOpcode, to restore the user values after the GOTO or GOTO_W's mergeJumps were processedstatic void
pre(edu.umd.cs.findbugs.OpcodeStack stack, int opcode)
called before the execution of the parent OpcodeStack.sawOpcode() to save user values if the opcode is a GOTO or GOTO_W.
-
-
-
Method Detail
-
pre
public static void pre(edu.umd.cs.findbugs.OpcodeStack stack, int opcode)
called before the execution of the parent OpcodeStack.sawOpcode() to save user values if the opcode is a GOTO or GOTO_W.- Parameters:
stack
- the OpcodeStack with the items containing user valuesopcode
- the opcode currently seen
-
post
public static void post(edu.umd.cs.findbugs.OpcodeStack stack, int opcode)
called after the execution of the parent OpcodeStack.sawOpcode, to restore the user values after the GOTO or GOTO_W's mergeJumps were processed- Parameters:
stack
- the OpcodeStack with the items containing user valuesopcode
- the opcode currently seen
-
-