ConstantPool, which directly stores
an array of Constant objects and can be made immutable.
| Modifier and Type | Field and Description |
|---|---|
| private final Constant[] | entries
|
| Access | Constructor and Description |
|---|---|
| public | StdConstantPool(int
the size of the pool; this corresponds to the
class file field size)constant_pool_count, and is in fact
always at least one more than the actual size of the constant pool,
as element 0 is always invalid.Constructs an instance. |
| Modifier and Type | Method and Description |
|---|---|
| public Constant | get(int
n >= 0, n < size(); the constant pool indexImplements org. nth entry in the constant pool, which must
be valid.
|
| public Constant | get0Ok(int
n >= 0, n < size(); the constant pool indexImplements org. nth entry in the constant pool, which must
be valid unless n == 0, in which case null
is returned.
|
| public Constant | getOrNull(int
n >= 0, n < size(); the constant pool indexImplements org. nth entry in the constant pool, or
null if the index is in-range but invalid.
|
| public void | |
| public int | size()
Implements org. |
| private static Constant |
| entries | back to summary |
|---|---|
| private final Constant[] entries
| |
| StdConstantPool | back to summary |
|---|---|
| public StdConstantPool(int size) Constructs an instance. All indices initially contain
| |
| get | back to summary |
|---|---|
| public Constant get(int n) Implements org. Doc from org. Get the
| |
| get0Ok | back to summary |
|---|---|
| public Constant get0Ok(int n) Implements org. Doc from org. Get the
| |
| getOrNull | back to summary |
|---|---|
| public Constant getOrNull(int n) Implements org. Doc from org. Get the
| |
| set | back to summary |
|---|---|
| public void set(int n, Constant cst) Sets the entry at the given index.
| |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from org. Get the "size" of the constant pool. This corresponds to the
class file field
| |
| throwInvalid | back to summary |
|---|---|
| private static Constant throwInvalid(int idx) Throws the right exception for an invalid cpi.
| |