Package com.android.dx.rop.cst
Interface ConstantPool
- All Known Implementing Classes:
StdConstantPool
public interface ConstantPool
Interface for constant pools, which are, more or less, just lists of
Constant
objects.-
Method Summary
Modifier and TypeMethodDescriptionget
(int n) Get then
th entry in the constant pool, which must be valid.get0Ok
(int n) Get then
th entry in the constant pool, which must be valid unlessn == 0
, in which casenull
is returned.Constant[]
Get all entries in this constant pool.getOrNull
(int n) Get then
th entry in the constant pool, ornull
if the index is in-range but invalid.int
size()
Get the "size" of the constant pool.
-
Method Details
-
size
int size()Get the "size" of the constant pool. This corresponds to the class file fieldconstant_pool_count
, and is in fact always at least one more than the actual size of the constant pool, as element0
is always invalid.- Returns:
>= 1;
the size
-
get
Get then
th entry in the constant pool, which must be valid.- Parameters:
n
-n >= 0, n < size();
the constant pool index- Returns:
non-null;
the corresponding entry- Throws:
IllegalArgumentException
- thrown ifn
is in-range but invalid
-
get0Ok
Get then
th entry in the constant pool, which must be valid unlessn == 0
, in which casenull
is returned.- Parameters:
n
-n >= 0, n < size();
the constant pool index- Returns:
null-ok;
the corresponding entry, ifn != 0
- Throws:
IllegalArgumentException
- thrown ifn
is in-range and non-zero but invalid
-
getOrNull
Get then
th entry in the constant pool, ornull
if the index is in-range but invalid. In particular,null
is returned for index0
as well as the index after any entry which is defined to take up two slots (that is,Long
andDouble
entries).- Parameters:
n
-n >= 0, n < size();
the constant pool index- Returns:
null-ok;
the corresponding entry, ornull
if the index is in-range but invalid
-
getEntries
Constant[] getEntries()Get all entries in this constant pool.- Returns:
- the returned array may contain null entries.
-