com.pnfsoftware.jeb.core.units.code.java.IJavaType |
This interface is used to define a Java type.
Those objects can represent exact types or wildcard (imprecise) types. They are used at both the IR and at the AST level.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | JAVA_LANG_CLASS | ||||||||||
String | JAVA_LANG_ENUM | ||||||||||
String | JAVA_LANG_EXCEPTION | ||||||||||
String | JAVA_LANG_INVOKE_CALLSITE | ||||||||||
String | JAVA_LANG_INVOKE_METHODHANDLE | ||||||||||
String | JAVA_LANG_INVOKE_METHODTYPE | ||||||||||
String | JAVA_LANG_OBJECT | ||||||||||
String | JAVA_LANG_STRING | ||||||||||
String | JAVA_LANG_THROWABLE |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract IJavaType |
asWildcardExt()
Retrieve an "extends" wildcard version of this type.
| ||||||||||
abstract IJavaType |
asWildcardSup()
Retrieve a "super" wildcard version of this type.
| ||||||||||
abstract boolean |
canSetType(IJavaType otherType, boolean useExternalTypeInfo)
Determine whether this type could be replaced by (as in, specialized) the provided other
type.
| ||||||||||
abstract IJavaType | compareAndGetMostPrecise(IJavaType other) | ||||||||||
abstract boolean |
compareSimple(IJavaType t)
Simple comparison: are both types objects (incl.
| ||||||||||
abstract void |
format(DFormattingContext fctx)
Get a programmer's representation for that type.
| ||||||||||
abstract void | formatArray(DFormattingContext fctx, IDExpression dim0) | ||||||||||
abstract IJavaType |
getArrayElementType()
Get the simplest type of an array type, that is, the type of a 0-dimension array.
| ||||||||||
abstract IJavaType |
getArrayTypeDimensionBelow()
Get the type of an imaginary array with one dimension less than the current array.
| ||||||||||
abstract int |
getDimensions()
Get the dimension count of an array type.
| ||||||||||
abstract IJavaTypeFactory | getFactory() | ||||||||||
abstract String |
getName()
Get the internal representation.
| ||||||||||
abstract String |
getSignature()
Get the Java type name (internal form).
| ||||||||||
abstract int |
getSlotCount()
This method will throw if called on the
void type! | ||||||||||
abstract boolean | isArray() | ||||||||||
abstract boolean | isBoolean() | ||||||||||
abstract boolean | isByte() | ||||||||||
abstract boolean | isChar() | ||||||||||
abstract boolean | isClassOrInterface() | ||||||||||
abstract boolean | isDefined() | ||||||||||
abstract boolean | isDetermined() | ||||||||||
abstract boolean | isDouble() | ||||||||||
abstract boolean |
isDoubleRegister()
This method is deprecated.
use
isDoubleSlot() instead
| ||||||||||
abstract boolean | isDoubleSlot() | ||||||||||
abstract boolean |
isDoubleSlotWildcard()
Wildcard type for any type whose concrete representation requires two slots.
| ||||||||||
abstract boolean | isFloat() | ||||||||||
abstract boolean | isFloatingPointType() | ||||||||||
abstract boolean |
isGenericInteger()
isSpecificInteger() + BOOLEAN and the generic type SMALLINT. | ||||||||||
abstract boolean |
isGenericObject()
This method is deprecated.
use
isGenericObjectWildcard() instead
| ||||||||||
abstract boolean |
isGenericObjectWildcard()
Wildcard type for any object.
| ||||||||||
abstract boolean | isInt() | ||||||||||
abstract boolean |
isJavaLangClass()
Convenience method.
| ||||||||||
abstract boolean |
isJavaLangObject()
Convenience method.
| ||||||||||
abstract boolean |
isJavaLangString()
Convenience method.
| ||||||||||
abstract boolean | isLegal() | ||||||||||
abstract boolean | isLong() | ||||||||||
abstract boolean | isObject() | ||||||||||
abstract boolean | isObjectWildcardExtends() | ||||||||||
abstract boolean | isObjectWildcardSuper() | ||||||||||
abstract boolean | isPrimitive() | ||||||||||
abstract boolean | isShort() | ||||||||||
abstract boolean |
isSingleRegister()
This method is deprecated.
use
isSingleSlot() instead
| ||||||||||
abstract boolean | isSingleSlot() | ||||||||||
abstract boolean |
isSingleSlotWildcard()
Wildcard type for any type whose concrete representation requires one slot.
| ||||||||||
abstract boolean | isSmallInt() | ||||||||||
abstract boolean |
isSmallIntegerWildcard()
Wildcard type for any small integer type (byte, char, short, int).
| ||||||||||
abstract boolean | isSpecificInteger() | ||||||||||
abstract boolean |
isStringType()
This method is deprecated.
use
isJavaLangString() instead | ||||||||||
abstract boolean | isUndefined() | ||||||||||
abstract boolean | isValidForRendering() | ||||||||||
abstract boolean | isVoid() | ||||||||||
abstract boolean | isWildcard() |
Retrieve an "extends" wildcard version of this type.
Watch out! For extends-wildcards, this method returns the same type. For super-wildcards, this method does NOT return the generic object type. It returns the extends-wildcard of the non-wildcard type.
Retrieve a "super" wildcard version of this type.
Watch out! For super-wildcards, this method returns the same type. For extends-wildcards, this method does NOT return the generic object type. It returns the super-wildcard of the non-wildcard type.
Determine whether this type could be replaced by (as in, specialized) the provided other type. Unless the other type is the same as this type, this method will fail if this type is not a wildcard.
For objects, do not confuse this method with type hierarchy checkers. Example: if this type
is List
, this method will return false if the other type is e.g. ArrayList
,
because List
is already a specific type. However, if this type were to be
?_extends_List
, the method would return true for any type extending List
,
including List
itself or ArrayList
.
otherType | another type |
---|
Simple comparison: are both types objects (incl. arrays) or ints, etc.
Note 1: comparing a String to an ArrayList or an array of int would return true.
Note 2: comparing an int to a smallint would return false>.
Get a programmer's representation for that type. Examples:
- top-level class Lcom/foo/B$la;
becomes com.foo.B$la
- inner class Lcom/foo/Farm$Cow;
becomes com.foo.Farm.Cow
fctx | sink and formatting context |
---|
fctx | sink and formatting context |
---|
Get the simplest type of an array type, that is, the type of a 0-dimension array.
Example: [[[I -> I
Get the type of an imaginary array with one dimension less than the current array.
Example: [[[I -> [[I
Get the dimension count of an array type. This method will throw if this type is not an array.
Get the internal representation. Never fail. If the type is a wildcard reference, the type
reference without wildcard is returned (example: on type ? extends T
, this method
will return "T").
Get the Java type name (internal form).
L.../...;
form
This method will throw if called on the void
type!
boolean
primitive
byte
primitive
char
primitive
double
primitive
Wildcard type for any type whose concrete representation requires two slots.
float
primitive
float
or double
isSpecificInteger()
+ BOOLEAN and the generic type SMALLINT.
Wildcard type for any object.
int
primitive
Convenience method.
java.lang.Class
.
Convenience method.
java.lang.Object
.
Convenience method.
java.lang.String
.
long
primitive
? extends SomeType
? super SomeType
short
primitive
Wildcard type for any type whose concrete representation requires one slot.
BYTE, CHAR, SHORT, INT
or SMALLINT
(wildcard type for any of
the previous small-integer types)
Wildcard type for any small integer type (byte, char, short, int).
void
(i.e. not a type, or the illegal type)