# Interface: 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.

## Static Field: JAVA_LANG_CLASS
Type: `java.lang.String`

Constant value: `Ljava/lang/Class;`
Description: Signature of `java.lang.Class`.

## Static Field: JAVA_LANG_ENUM
Type: `java.lang.String`

Constant value: `Ljava/lang/Enum;`
Description: Signature of `java.lang.Enum`.

## Static Field: JAVA_LANG_EXCEPTION
Type: `java.lang.String`

Constant value: `Ljava/lang/Exception;`
Description: Signature of `java.lang.Exception`.

## Static Field: JAVA_LANG_INVOKE_CALLSITE
Type: `java.lang.String`

Constant value: `Ljava/lang/invoke/CallSite;`
Description: Signature of `java.lang.invoke.CallSite`.

## Static Field: JAVA_LANG_INVOKE_METHODHANDLE
Type: `java.lang.String`

Constant value: `Ljava/lang/invoke/MethodHandle;`
Description: Signature of `java.lang.invoke.MethodHandle`.

## Static Field: JAVA_LANG_INVOKE_METHODTYPE
Type: `java.lang.String`

Constant value: `Ljava/lang/invoke/MethodType;`
Description: Signature of `java.lang.invoke.MethodType`.

## Static Field: JAVA_LANG_OBJECT
Type: `java.lang.String`

Constant value: `Ljava/lang/Object;`
Description: Signature of `java.lang.Object`.

## Static Field: JAVA_LANG_STRING
Type: `java.lang.String`

Constant value: `Ljava/lang/String;`
Description: Signature of `java.lang.String`.

## Static Field: JAVA_LANG_THROWABLE
Type: `java.lang.String`

Constant value: `Ljava/lang/Throwable;`
Description: Signature of `java.lang.Throwable`.

## Method: asWildcardExt
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: 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.
return: the extends\-wildcard version of this type

## Method: asWildcardSup
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: 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.
return: the super\-wildcard version of this type

## Method: canSetType
- parameter: `otherType`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`
- parameter: `useExternalTypeInfo`, type: `boolean`
- return type: `boolean`

Description: 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`.
parameter: otherType: another type
parameter: useExternalTypeInfo: true to use external hierarchy/type information when available
return: success indicator

## Method: compareAndGetMostPrecise
- parameter: `other`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: Compare this type with another one and return the most precise type if it can be determined.
parameter: other: type to compare with this one
return: the most precise type, or null if no precise type can be selected

## Method: compareSimple
- parameter: `t`, type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`
- return type: `boolean`

Description: 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**.
parameter: t: type to compare with this one
return: true if both types have the same simple category

## Method: format
- parameter: `fctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DFormattingContext`

Description: 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`
parameter: fctx: sink and formatting context

## Method: formatArray
- parameter: `fctx`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.DFormattingContext`
- parameter: `dim0`, type: `com.pnfsoftware.jeb.core.units.code.android.ir.IDExpression`

Description: Format this type as an array type, optionally with the first\-dimension expression.
parameter: fctx: sink and formatting context
parameter: dim0: first\-dimension expression, or null

## Method: getArrayElementType
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: Get the simplest type of an array type, that is, the type of a 0\-dimension array.
 Example: \[\[\[I \-\> I
return: the base element type

## Method: getArrayTypeDimensionBelow
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaType`

Description: Get the type of an imaginary array with one dimension less than the current array.
 Example: \[\[\[I \-\> \[\[I
return: the array type one dimension below this type

## Method: getDimensions
- return type: `int`

Description: Get the dimension count of an array type. This method will throw if this type is not an array.
return: the number of array dimensions

## Method: getEncodingBitsize
- return type: `int`

Description: 
return: the memory bitsize required to store such a type \(or type\-reference, for an object         type\), such as 1 for a boolean, 8 for a char, 16 for a short/char32 for an         int/float/ref, 64 for a long/double, etc.

## Method: getFactory
- return type: `com.pnfsoftware.jeb.core.units.code.java.IJavaTypeFactory`

Description: 
return: the type factory that created this type object

## Method: getName
- return type: `java.lang.String`

Description: 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"\).
return: internal representation of the type name

## Method: getSignature
- return type: `java.lang.String`

Description: Get the Java type name \(original internal form\).
return: internal type name, using the `L.../...;` form

## Method: getSignature
- parameter: `doNotRenderWildcard`, type: `boolean`
- return type: `java.lang.String`

Description: Get the Java type name \(original internal form\).
parameter: doNotRenderWildcard: true to omit wildcard markers from the returned signature
return: internal type name, using the `L.../...;` form

## Method: getSlotCount
- return type: `int`

Description: This method will throw if called on the `void` type\!
return: 1 or 2

## Method: isArray
- return type: `boolean`

Description: 
return: true if this type is an array type

## Method: isBoolean
- return type: `boolean`

Description: 
return: true if this type is the `boolean` primitive

## Method: isByte
- return type: `boolean`

Description: 
return: true if this type is the `byte` primitive

## Method: isChar
- return type: `boolean`

Description: 
return: true if this type is the `char` primitive

## Method: isClassOrInterface
- return type: `boolean`

Description: 
return: true if this type is a class or interface type \(not an array type, not a primitive\)

## Method: isDefined
- return type: `boolean`

Description: 
return: true if anything but void or the single\-slot or double\-slot wildcard

## Method: isDetermined
- return type: `boolean`

Description: 
return: true if anything but void or a wildcard type

## Method: isDouble
- return type: `boolean`

Description: 
return: true if this type is the `double` primitive

## Method: isDoubleSlot
- return type: `boolean`

Description: 
return: true if the concrete representation of this type is stored in a two slots

## Method: isDoubleSlotWildcard
- return type: `boolean`

Description: Wildcard type for any type whose concrete representation requires two slots.
return: true if this type is the double\-slot wildcard

## Method: isFloat
- return type: `boolean`

Description: 
return: true if this type is the `float` primitive

## Method: isFloatingPointType
- return type: `boolean`

Description: 
return: true if `float` or `double`

## Method: isGenericInteger
- return type: `boolean`

Description: [#isSpecificInteger()](#isSpecificInteger()) \+ BOOLEAN and the generic type SMALLINT.
return: true if this type is a generic integer type

## Method: isGenericObjectWildcard
- return type: `boolean`

Description: Wildcard type for any object.
return: true if this type is the generic object wildcard

## Method: isInt
- return type: `boolean`

Description: 
return: true if this type is the `int` primitive

## Method: isJavaLangClass
- return type: `boolean`

Description: Convenience method.
return: true if this type is `java.lang.Class`.

## Method: isJavaLangObject
- return type: `boolean`

Description: Convenience method.
return: true if this type is `java.lang.Object`.

## Method: isJavaLangString
- return type: `boolean`

Description: Convenience method.
return: true if this type is `java.lang.String`.

## Method: isLegal
- return type: `boolean`

Description: 
return: true if non\-void

## Method: isLong
- return type: `boolean`

Description: 
return: true if this type is the `long` primitive

## Method: isObject
- return type: `boolean`

Description: 
return: true if this type is an object type: could be the generic\-object wildcard, a specific         class or interface type, an array type

## Method: isObjectWildcard
- return type: `boolean`

Description: 
return: true if this type is a specialization or generalization wildcard

## Method: isObjectWildcardExtends
- return type: `boolean`

Description: 
return: true if this type is a specialization wildcard: `? extends SomeType`

## Method: isObjectWildcardSuper
- return type: `boolean`

Description: 
return: true if this type is a generalization wildcard: `? super SomeType`

## Method: isPrimitive
- return type: `boolean`

Description: 
return: true if this type is a primitive

## Method: isShort
- return type: `boolean`

Description: 
return: true if this type is the `short` primitive

## Method: isSingleSlot
- return type: `boolean`

Description: 
return: true if the concrete representation of this type is stored in a single slot

## Method: isSingleSlotWildcard
- return type: `boolean`

Description: Wildcard type for any type whose concrete representation requires one slot.
return: true if this type is the single\-slot wildcard

## Method: isSmallInt
- return type: `boolean`

Description: 
return: true for `BYTE, CHAR, SHORT, INT` or `SMALLINT` \(wildcard type for any of         the previous small\-integer types\)

## Method: isSmallIntegerWildcard
- return type: `boolean`

Description: Wildcard type for any small integer type \(byte, char, short, int\).
return: true if this type is the small\-integer wildcard

## Method: isSpecificInteger
- return type: `boolean`

Description: 
return: true for byte, char, short, int or long \(note: the small\-int wildcard is NOT a         specific integer\)

## Method: isUndefined
- return type: `boolean`

Description: 
return: true if void, the single\-slot, or the double\-slot wildcard

## Method: isValidForRendering
- return type: `boolean`

Description: Determine whether this type can be rendered as Java source.
return: true if this type is valid for rendering

## Method: isVoid
- return type: `boolean`

Description: 
return: true if this "type" is `void` \(i.e. not a type, or the illegal type\)

## Method: isWildcard
- return type: `boolean`

Description: 
return: true if small\-int wildcard, single\-slot wildcard, double\-slot wildcard,         generic\-object wildcard

