org.apache.bcel.generic

Class InvokeInstruction

Implemented Interfaces:
Cloneable, ExceptionThrower, IndexedInstruction, LoadClass, Serializable, StackConsumer, StackProducer, TypedInstruction
Known Direct Subclasses:
INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL

public abstract class InvokeInstruction
extends FieldOrMethod
implements ExceptionThrower, TypedInstruction, StackConsumer, StackProducer

Super class for the INVOKExxx family of instructions.
Version:
$Id: InvokeInstruction.java 386056 2006-03-15 11:31:56Z tcurdt $
Author:
M. Dahm

Field Summary

Fields inherited from class org.apache.bcel.generic.CPInstruction

index

Fields inherited from class org.apache.bcel.generic.Instruction

cmp, length, opcode

Constructor Summary

InvokeInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction().
InvokeInstruction(short opcode, int index)

Method Summary

int
consumeStack(ConstantPoolGen cpg)
Also works for instructions whose stack effect depends on the constant pool entry they reference.
Type[]
getArgumentTypes(ConstantPoolGen cpg)
String
getMethodName(ConstantPoolGen cpg)
Type
getReturnType(ConstantPoolGen cpg)
Type
getType(ConstantPoolGen cpg)
int
produceStack(ConstantPoolGen cpg)
Also works for instructions whose stack effect depends on the constant pool entry they reference.
String
toString(ConstantPool cp)

Methods inherited from class org.apache.bcel.generic.FieldOrMethod

getClassName, getClassType, getLoadClassType, getName, getReferenceType, getSignature

Methods inherited from class org.apache.bcel.generic.CPInstruction

dump, getIndex, getType, initFromFile, setIndex, toString, toString

Methods inherited from class org.apache.bcel.generic.Instruction

accept, className, consumeStack, copy, dispose, dump, equals, getComparator, getLength, getName, getOpcode, initFromFile, produceStack, readInstruction, setComparator, setOpcode, toString, toString, toString

Constructor Details

InvokeInstruction

(package private)  InvokeInstruction()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

InvokeInstruction

protected InvokeInstruction(short opcode,
                            int index)
Parameters:
index - to constant pool

Method Details

consumeStack

public int consumeStack(ConstantPoolGen cpg)
Also works for instructions whose stack effect depends on the constant pool entry they reference.
Specified by:
consumeStack in interface StackConsumer
Overrides:
consumeStack in interface Instruction
Returns:
Number of words consumed from stack by this instruction

getArgumentTypes

public Type[] getArgumentTypes(ConstantPoolGen cpg)
Returns:
argument types of referenced method.

getMethodName

public String getMethodName(ConstantPoolGen cpg)
Returns:
name of referenced method.

getReturnType

public Type getReturnType(ConstantPoolGen cpg)
Returns:
return type of referenced method.

getType

public Type getType(ConstantPoolGen cpg)
Specified by:
getType in interface TypedInstruction
getType in interface LoadClass
Overrides:
getType in interface CPInstruction
Returns:
return type of referenced method.

produceStack

public int produceStack(ConstantPoolGen cpg)
Also works for instructions whose stack effect depends on the constant pool entry they reference.
Specified by:
produceStack in interface StackProducer
Overrides:
produceStack in interface Instruction
Returns:
Number of words produced onto stack by this instruction

toString

public String toString(ConstantPool cp)
Overrides:
toString in interface CPInstruction
Returns:
mnemonic for instruction with symbolic references resolved