FileDocCategorySizeDatePackage
MULTIANEWARRAY.javaAPI DocJava SE 5 API6378Fri Aug 26 14:55:24 BST 2005com.sun.org.apache.bcel.internal.generic

MULTIANEWARRAY

public class MULTIANEWARRAY extends CPInstruction implements ExceptionThrower, LoadClass, AllocationInstruction
MULTIANEWARRAY - Create new mutidimensional array of references
Stack: ..., count1, [count2, ...] -> ..., arrayref
version
$Id: MULTIANEWARRAY.java,v 1.1.1.1 2001/10/29 20:00:24 jvanzyl Exp $
author
M. Dahm

Fields Summary
private short
dimensions
Constructors Summary
MULTIANEWARRAY()
Empty constructor needed for the Class.newInstance() statement in Instruction.readInstruction(). Not to be used otherwise.

public MULTIANEWARRAY(int index, short dimensions)

    super(com.sun.org.apache.bcel.internal.Constants.MULTIANEWARRAY, index);

    if(dimensions < 1)
      throw new ClassGenException("Invalid dimensions value: " + dimensions);

    this.dimensions = dimensions;
    length = 4;
  
Methods Summary
public voidaccept(com.sun.org.apache.bcel.internal.generic.Visitor v)
Call corresponding visitor method(s). The order is: Call visitor methods of implemented interfaces first, then call methods according to the class hierarchy in descending order, i.e., the most specific visitXXX() call comes last.

param
v Visitor object

    v.visitLoadClass(this);
    v.visitAllocationInstruction(this);
    v.visitExceptionThrower(this);
    v.visitTypedInstruction(this);
    v.visitCPInstruction(this);
    v.visitMULTIANEWARRAY(this);
  
public intconsumeStack(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)
Also works for instructions whose stack effect depends on the constant pool entry they reference.

return
Number of words consumed from stack by this instruction

 return dimensions; 
public voiddump(java.io.DataOutputStream out)
Dump instruction as byte code to stream out.

param
out Output stream

    out.writeByte(opcode);
    out.writeShort(index);
    out.writeByte(dimensions);
  
public final shortgetDimensions()

return
number of dimensions to be created

 return dimensions; 
public java.lang.Class[]getExceptions()

    Class[] cs = new Class[2 + ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length];

    System.arraycopy(ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION, 0,
		     cs, 0, ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length);

    cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length+1] = ExceptionConstants.NEGATIVE_ARRAY_SIZE_EXCEPTION;
    cs[ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION.length]   = ExceptionConstants.ILLEGAL_ACCESS_ERROR;

    return cs;
  
public com.sun.org.apache.bcel.internal.generic.ObjectTypegetLoadClassType(com.sun.org.apache.bcel.internal.generic.ConstantPoolGen cpg)

    Type t = getType(cpg);
    
    if (t instanceof ArrayType){
      t = ((ArrayType) t).getBasicType();
    }
    
    return (t instanceof ObjectType)? (ObjectType) t : null;
  
protected voidinitFromFile(com.sun.org.apache.bcel.internal.util.ByteSequence bytes, boolean wide)
Read needed data (i.e., no. dimension) from file.

    super.initFromFile(bytes, wide);
    dimensions = bytes.readByte();
    length     = 4;
  
public java.lang.StringtoString(boolean verbose)

return
mnemonic for instruction

    return super.toString(verbose) + " " + index + " " + dimensions;
  
public java.lang.StringtoString(com.sun.org.apache.bcel.internal.classfile.ConstantPool cp)

return
mnemonic for instruction with symbolic references resolved

    return super.toString(cp) + " " + dimensions;