ArrayTypepublic final class ArrayType extends ReferenceType Denotes array type, such as int[][] |
Fields Summary |
---|
private int | dimensions | private Type | basic_type |
Constructors Summary |
---|
public ArrayType(byte type, int dimensions)Convenience constructor for array type, e.g. int[]
this(BasicType.getType(type), dimensions);
| public ArrayType(String class_name, int dimensions)Convenience constructor for reference array type, e.g. Object[]
this(new ObjectType(class_name), dimensions);
| public ArrayType(Type type, int dimensions)Constructor for array of given type
super(Constants.T_ARRAY, "<dummy>");
if((dimensions < 1) || (dimensions > Constants.MAX_BYTE))
throw new ClassGenException("Invalid number of dimensions: " + dimensions);
switch(type.getType()) {
case Constants.T_ARRAY:
ArrayType array = (ArrayType)type;
this.dimensions = dimensions + array.dimensions;
basic_type = array.basic_type;
break;
case Constants.T_VOID:
throw new ClassGenException("Invalid type: void[]");
default: // Basic type or reference
this.dimensions = dimensions;
basic_type = type;
break;
}
StringBuffer buf = new StringBuffer();
for(int i=0; i < this.dimensions; i++)
buf.append('[");
buf.append(basic_type.getSignature());
signature = buf.toString();
|
|