Package com.android.dx.rop.cst
Class CstKnownNull
java.lang.Object
com.android.dx.rop.cst.Constant
com.android.dx.rop.cst.TypedConstant
com.android.dx.rop.cst.CstLiteralBits
com.android.dx.rop.cst.CstKnownNull
- All Implemented Interfaces:
TypeBearer
,ToHuman
,Comparable<Constant>
Constant type to represent a known-
null
value.-
Field Summary
Modifier and TypeFieldDescriptionstatic final CstKnownNull
non-null;
unique instance of this class -
Method Summary
Modifier and TypeMethodDescriptionprotected int
compareTo0
(Constant other) Compare the values of this and another instance, which are guaranteed to be of the same class.boolean
boolean
Returns whether or not this instance's value may be accurately represented as anint
.int
Gets the value asint
bits.long
Gets the value aslong
bits.getType()
Gets the type associated with this instance.int
hashCode()
boolean
Returnstrue
if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, orfalse
if this instance is category-1.toHuman()
Return the "human" string form of this instance.toString()
typeName()
Returns the human name for the particular type of constant this instance is.Methods inherited from class com.android.dx.rop.cst.CstLiteralBits
fitsIn16Bits, fitsIn8Bits
Methods inherited from class com.android.dx.rop.cst.TypedConstant
getBasicFrameType, getBasicType, getFrameType, isConstant
-
Field Details
-
THE_ONE
non-null;
unique instance of this class
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
compareTo0
Compare the values of this and another instance, which are guaranteed to be of the same class. Subclasses must implement this.- Specified by:
compareTo0
in classConstant
- Parameters:
other
-non-null;
the instance to compare to- Returns:
-1
,0
, or1
, as usual for a comparison
-
toString
-
getType
Gets the type associated with this instance.- Returns:
non-null;
the type
-
typeName
Returns the human name for the particular type of constant this instance is. -
isCategory2
public boolean isCategory2()Returnstrue
if this instance is a category-2 constant, meaning it takes up two slots in the constant pool, orfalse
if this instance is category-1.- Specified by:
isCategory2
in classConstant
- Returns:
true
iff this instance is category-2
-
toHuman
Return the "human" string form of this instance. This is generally less "debuggy" thantoString()
.- Returns:
non-null;
the human string form
-
fitsInInt
public boolean fitsInInt()Returns whether or not this instance's value may be accurately represented as anint
. The rule is that if there is anint
which may be sign-extended to yield this instance's value, then this method returnstrue
. Otherwise, it returnsfalse
.- Specified by:
fitsInInt
in classCstLiteralBits
- Returns:
true
iff this instance fits in anint
-
getIntBits
public int getIntBits()Gets the value asint
bits. If this instance contains more bits than fit in anint
, then this returns only the low-order bits. As "literal bits," a known-null is always represented as the number zero.- Specified by:
getIntBits
in classCstLiteralBits
- Returns:
- the bits
-
getLongBits
public long getLongBits()Gets the value aslong
bits. If this instance contains fewer bits than fit in along
, then the result of this method is the sign extension of the value. As "literal bits," a known-null is always represented as the number zero.- Specified by:
getLongBits
in classCstLiteralBits
- Returns:
- the bits
-