* byte code generating backend of a compiler. You can subclass it to
* add your own create methods.
*
- * @version $Id: InstructionFactory.java,v 1.2 2004/11/19 16:45:19 aclement Exp $
+ * @version $Id: InstructionFactory.java,v 1.3 2005/01/31 11:32:21 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constants
*/
push = new PUSH(cp, (Boolean)value);
else if(value instanceof Character)
push = new PUSH(cp, (Character)value);
+ else if (value instanceof ObjectType)
+ push = new PUSH(cp, (ObjectType)value);
else
throw new ClassGenException("Illegal type: " + value.getClass());
* Wrapper class for push operations, which are implemented either as BIPUSH,
* LDC or xCONST_n instructions.
*
- * @version $Id: PUSH.java,v 1.4 2004/11/22 08:31:27 aclement Exp $
+ * @version $Id: PUSH.java,v 1.5 2005/01/31 11:32:21 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public final class PUSH
else // If everything fails create a Constant pool entry
instruction = new LDC(cp.addInteger(value));
}
+
+ public PUSH(ConstantPoolGen cp, ObjectType t) {
+ instruction = new LDC_W(cp.addClass(t));
+ }
/**
* @param cp Constant pool