FileDocCategorySizeDatePackage
MULTIANEWARRAY.javaAPI DocJava SE 6 API6381Tue Jun 10 00:22:22 BST 2008com.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.2.1 2005/07/31 23:45:48 jeffsuttor 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;