Package com.mebigfatguy.fbcontrib.utils
Class TernaryPatcher
java.lang.Object
com.mebigfatguy.fbcontrib.utils.TernaryPatcher
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
FieldsModifier and TypeFieldDescriptionprivate static boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidpost(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 voidpre(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.
-
Field Details
-
userValues
-
sawGOTO
private static boolean sawGOTO
-
-
Constructor Details
-
TernaryPatcher
private TernaryPatcher()
-
-
Method Details
-
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
-