Question

I am currently instrumenting bytecode using BCEL. In the BCEL API, the two instructions types LOOKUPSWITCH and TABLESWITCH (package org.apache.bcel.generic) are implementing interface StackProducer. I know that these two instructions pop the operand stack (i.e. consume it) and do not produce anything on the stack, so how come they implement StackProducer instead of StackConsumer? Is this a bug? Thank you

(ps: I tried to post this question on the BCEL mailing list with no answer. I hope I'll find more luck here)

Was it helpful?

Solution

It was a bug. But it has been fixed a while ago now.

tree:generic jbevain$ svn log -c 1081190 && svn diff -c 1081190
------------------------------------------------------------------------
r1081190 | dbrosius | 2011-03-13 19:41:20 +0100 (Sun, 13 Mar 2011) | 1 line

Bug 48908 - Select instructions should implement StackConsumer instead of StackProducer
------------------------------------------------------------------------
Index: Select.java
===================================================================
--- Select.java (revision 1081189)
+++ Select.java (revision 1081190)
@@ -33,7 +33,7 @@
  * @see InstructionList
  */
 public abstract class Select extends BranchInstruction implements VariableLengthInstruction,
-        StackProducer {
+        StackConsumer {

     private static final long serialVersionUID = 2806771744559217250L;
     protected int[] match; // matches, i.e., case 1: ...

Select is the base class for LOOKUPSWITCH and TABLESWITCH.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top