Top Description Inners Fields Constructors Methods
javassist.expr

public Class NewArray

extends Expr
Class Inheritance
Imports
javassist.CannotCompileException, .CtBehavior, .CtClass, .CtPrimitiveType, .NotFoundException, javassist.bytecode.BadBytecode, .Bytecode, .CodeAttribute, .CodeIterator, .ConstPool, .Descriptor, .MethodInfo, .Opcode, javassist.compiler.CompileError, .Javac, .JvstCodeGen, .JvstTypeChecker, .ProceedHandler, javassist.compiler.ast.ASTList

Array creation.

This class does not provide methods for obtaining the initial values of array elements.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv int
Inherited from javassist.expr.Expr:
currentPoseditediteratorjavaLangObjectmaxLocalsmaxStackthisClassthisMethod

Constructor Summary

AccessConstructor and Description
protected
NewArray(int pos, CodeIterator i, CtClass declaring, MethodInfo m, int op)

Method Summary

Modifier and TypeMethod and Description
public CtClass
getComponentType()

Returns the type of array components.

public int
getCreatedDimensions()

Returns the number of dimensions of arrays to be created.

public int
getDimension()

Returns the dimension of the created array.

public String

Returns:

null if this information is not available.
getFileName
()

Overrides javassist.expr.Expr.getFileName.

Returns the source file containing the array creation.

public int

Returns:

-1 if this information is not available.
getLineNumber
()

Overrides javassist.expr.Expr.getLineNumber.

Returns the line number of the source line containing the array creation.

pack-priv CtClass
getPrimitiveType(int atype)

public CtClass[]
mayThrow()

Overrides javassist.expr.Expr.mayThrow.

Returns the list of exceptions that the expression may throw.

public void
replace(String
a Java statement except try-catch.
statement
)

Implements abstract javassist.expr.Expr.replace.

Replaces the array creation with the bytecode derived from the given source text.

private void
replace2(String statement)

public CtBehavior
where()

Overrides javassist.expr.Expr.where.

Returns the method or constructor containing the array creation represented by this object.

Inherited from javassist.expr.Expr:
checkResultValueeditedgetConstPoolgetEnclosingClassindexOfBytecodelocalsreplacereplace0runEditorstackstoreStackwithinStatic

Field Detail

opcodeback to summary
pack-priv int opcode

Constructor Detail

NewArrayback to summary
protected NewArray(int pos, CodeIterator i, CtClass declaring, MethodInfo m, int op)

Method Detail

getComponentTypeback to summary
public CtClass getComponentType() throws NotFoundException

Returns the type of array components. If the created array is a two-dimensional array of int, the type returned by this method is not int[] but int.

getCreatedDimensionsback to summary
public int getCreatedDimensions()

Returns the number of dimensions of arrays to be created. If the opcode is multianewarray, this method returns the second operand. Otherwise, it returns 1.

getDimensionback to summary
public int getDimension()

Returns the dimension of the created array.

getFileNameback to summary
public String getFileName()

Overrides javassist.expr.Expr.getFileName.

Returns the source file containing the array creation.

Returns:String

null if this information is not available.

Annotations
@Override
getLineNumberback to summary
public int getLineNumber()

Overrides javassist.expr.Expr.getLineNumber.

Returns the line number of the source line containing the array creation.

Returns:int

-1 if this information is not available.

Annotations
@Override
getPrimitiveTypeback to summary
pack-priv CtClass getPrimitiveType(int atype)
mayThrowback to summary
public CtClass[] mayThrow()

Overrides javassist.expr.Expr.mayThrow.

Returns the list of exceptions that the expression may throw. This list includes both the exceptions that the try-catch statements including the expression can catch and the exceptions that the throws declaration allows the method to throw.

Annotations
@Override
replaceback to summary
public void replace(String statement) throws CannotCompileException

Implements abstract javassist.expr.Expr.replace.

Replaces the array creation with the bytecode derived from the given source text.

$0 is available even if the called method is static. If the field access is writing, $_ is available but the value of $_ is ignored.

Parameters
statement:String

a Java statement except try-catch.

Annotations
@Override
replace2back to summary
private void replace2(String statement) throws CompileError, NotFoundException, BadBytecode, CannotCompileException
whereback to summary
public CtBehavior where()

Overrides javassist.expr.Expr.where.

Returns the method or constructor containing the array creation represented by this object.

Annotations
@Override
javassist.expr back to summary

pack-priv Class NewArray.ProceedForArray

extends Object
implements ProceedHandler
Class Inheritance
All Implemented Interfaces
javassist.compiler.ProceedHandler

Field Summary

Modifier and TypeField and Description
pack-priv CtClass
pack-priv int
pack-priv int
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv
ProceedForArray(CtClass type, int op, int i, int dim)

Method Summary

Modifier and TypeMethod and Description
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayTypeback to summary
pack-priv CtClass arrayType
dimensionback to summary
pack-priv int dimension
indexback to summary
pack-priv int index
opcodeback to summary
pack-priv int opcode

Constructor Detail

ProceedForArrayback to summary
pack-priv ProceedForArray(CtClass type, int op, int i, int dim)

Method Detail

doitback to summary
public void doit(JvstCodeGen gen, Bytecode bytecode, ASTList args) throws CompileError

Implements javassist.compiler.ProceedHandler.doit.

Annotations
@Override
setReturnTypeback to summary
public void setReturnType(JvstTypeChecker c, ASTList args) throws CompileError

Implements javassist.compiler.ProceedHandler.setReturnType.

Annotations
@Override