Package daikon
Class ProglangType
- Object
-
- ProglangType
-
- All Implemented Interfaces:
Serializable
@Interned public final class ProglangType extends Object implements Serializable
Represents the type of a variable, for its declared type, dtrace file representation, and internal representations. ProgLangTypes are interned, so they can be == compared.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ProglangType
BOOLEAN
static ProglangType
BOOLEAN_ARRAY
static ProglangType
CHAR
static ProglangType
CHAR_ARRAY
static ProglangType
CHAR_ARRAY_ARRAY
static boolean
dkconfig_convert_to_signed
If true, treat 32 bit values whose high bit is on, as a negative number (rather than as a 32 bit unsigned).static ProglangType
DOUBLE
static ProglangType
DOUBLE_ARRAY
static ProglangType
HASHCODE
static ProglangType
HASHCODE_ARRAY
static ProglangType
INT
static ProglangType
INT_ARRAY
static ProglangType
INTEGER
static HashSet<String>
list_implementors
The set of (interned) names of classes that implement java.util.List.static ProglangType
LONG_OBJECT
static ProglangType
LONG_PRIMITIVE
static ProglangType
LONG_PRIMITIVE_ARRAY
static ProglangType
OBJECT
static ProglangType
STRING
static ProglangType
STRING_ARRAY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description @Interned String
base()
boolean
baseIsBoolean()
boolean
baseIsFloat()
boolean
baseIsHashcode()
boolean
baseIsIntegral()
boolean
baseIsObject()
Return true if the base (the final element type) is a reference type rather than integer, float, or boolean.boolean
baseIsPrimitive()
boolean
baseIsScalar()
boolean
baseIsString()
boolean
comparableOrSuperclassEitherWay(ProglangType other)
Return true if these two types can be sensibly compared to one another, or if one can be cast to the other.boolean
comparableOrSuperclassOf(ProglangType other)
Return true if these two types can be sensibly compared to one another, and if non-integral, whether this could be a superclass of other.int
dimensions()
Return the number of dimensions (zero for a non-array).boolean
elementIsFloat()
boolean
elementIsIntegral()
boolean
elementIsString()
ProglangType
elementType()
Returns the type of elements of this.ProglangType
fileTypeToRepType()
Convert a file representation type to an internal representation type.String
format()
boolean
is_function_pointer()
Returns whether or not this declared type is a function pointer Only valid if the front end marks the function pointer with the name '*func'.boolean
isArray()
boolean
isFloat()
boolean
isHashcode()
boolean
isIndex()
boolean
isIntegral()
boolean
isObject()
Return true if this is java.lang.Object.boolean
isPointerFileRep()
Does this type represent a pointer?boolean
isPrimitive()
boolean
isScalar()
boolean
isString()
static ProglangType
parse(String rep)
This can't be a constructor because it returns a canonical representation (that can be compared with ==), not necessarily a new object.@Nullable @Interned Object
parse_value(String value, LineNumberReader reader, String filename)
Given a string representation of a value (of the type represented by this ProglangType), return the (canonicalized) interpretation of that value.@Nullable @Interned Object
parse_value_array_1d(String value, LineNumberReader reader, String filename)
@Nullable @Interned Object
parse_value_array_2d(String value, LineNumberReader reader, String filename)
@Nullable @Interned Object
parse_value_scalar(String value, LineNumberReader reader, String filename)
Object
readResolve()
For serialization; indicates which object to return instead of the one that was just read from the file.static ProglangType
rep_parse(String rep)
Like parse, but normalizes representation types (such as converting "float" to "double"), in order to return real file representation types even if the file contains something slightly different than the prescribed format.String
toString()
-
-
-
Field Detail
-
list_implementors
public static HashSet<String> list_implementors
The set of (interned) names of classes that implement java.util.List. For a Java class, this is a@BinaryName
, but when Daikon is processing programs written in other languages, it can be arbitrary.
-
dkconfig_convert_to_signed
public static boolean dkconfig_convert_to_signed
If true, treat 32 bit values whose high bit is on, as a negative number (rather than as a 32 bit unsigned).
-
INT
public static final ProglangType INT
-
LONG_PRIMITIVE
public static final ProglangType LONG_PRIMITIVE
-
DOUBLE
public static final ProglangType DOUBLE
-
CHAR
public static final ProglangType CHAR
-
STRING
public static final ProglangType STRING
-
INT_ARRAY
public static final ProglangType INT_ARRAY
-
LONG_PRIMITIVE_ARRAY
public static final ProglangType LONG_PRIMITIVE_ARRAY
-
DOUBLE_ARRAY
public static final ProglangType DOUBLE_ARRAY
-
CHAR_ARRAY
public static final ProglangType CHAR_ARRAY
-
STRING_ARRAY
public static final ProglangType STRING_ARRAY
-
CHAR_ARRAY_ARRAY
public static final ProglangType CHAR_ARRAY_ARRAY
-
INTEGER
public static final ProglangType INTEGER
-
LONG_OBJECT
public static final ProglangType LONG_OBJECT
-
OBJECT
public static final ProglangType OBJECT
-
BOOLEAN
public static final ProglangType BOOLEAN
-
HASHCODE
public static final ProglangType HASHCODE
-
BOOLEAN_ARRAY
public static final ProglangType BOOLEAN_ARRAY
-
HASHCODE_ARRAY
public static final ProglangType HASHCODE_ARRAY
-
-
Method Detail
-
dimensions
public int dimensions()
Return the number of dimensions (zero for a non-array).- Returns:
- the number of dimensions
-
isArray
@Pure public boolean isArray()
-
parse
public static ProglangType parse(String rep)
This can't be a constructor because it returns a canonical representation (that can be compared with ==), not necessarily a new object.- Parameters:
rep
- the name of the type, optionally suffixed by (possibly multiple) "[]"
-
rep_parse
public static ProglangType rep_parse(String rep)
Like parse, but normalizes representation types (such as converting "float" to "double"), in order to return real file representation types even if the file contains something slightly different than the prescribed format.
-
fileTypeToRepType
public ProglangType fileTypeToRepType()
Convert a file representation type to an internal representation type.
-
readResolve
public Object readResolve() throws ObjectStreamException
For serialization; indicates which object to return instead of the one that was just read from the file. This obviates the need to write a readObject method that interns the interned fields (just "base").- Throws:
ObjectStreamException
-
elementType
public ProglangType elementType(@GuardSatisfied ProglangType this)
Returns the type of elements of this. They may themselves be arrays if this is multidimensional.
-
parse_value
public final @Nullable @Interned Object parse_value(String value, LineNumberReader reader, String filename)
Given a string representation of a value (of the type represented by this ProglangType), return the (canonicalized) interpretation of that value.This ProglangType (the method receiver) is assumed to be a representation type, not an arbitrary type in the underlying programming language.
If the type is an array and there are any nonsensical elements in the array, the entire array is considered to be nonsensical (indicated by returning null). This is not really correct, but it is a reasonable path to take for now. (jhp, Feb 12, 2005)
-
parse_value_scalar
public final @Nullable @Interned Object parse_value_scalar(String value, LineNumberReader reader, String filename)
-
parse_value_array_1d
public final @Nullable @Interned Object parse_value_array_1d(String value, LineNumberReader reader, String filename)
-
parse_value_array_2d
public final @Nullable @Interned Object parse_value_array_2d(String value, LineNumberReader reader, String filename)
-
baseIsPrimitive
public boolean baseIsPrimitive()
-
isPrimitive
@Pure public boolean isPrimitive()
-
baseIsIntegral
public boolean baseIsIntegral()
-
isIntegral
@Pure public boolean isIntegral()
-
elementIsIntegral
public boolean elementIsIntegral()
-
elementIsFloat
public boolean elementIsFloat()
-
elementIsString
public boolean elementIsString()
-
isIndex
@Pure public boolean isIndex()
-
isScalar
@Pure public boolean isScalar()
-
baseIsScalar
public boolean baseIsScalar()
-
baseIsBoolean
public boolean baseIsBoolean()
-
baseIsFloat
public boolean baseIsFloat()
-
isFloat
@Pure public boolean isFloat()
-
isObject
@Pure public boolean isObject()
Return true if this is java.lang.Object.- Returns:
- true if this is java.lang.Object
-
baseIsObject
public boolean baseIsObject()
Return true if the base (the final element type) is a reference type rather than integer, float, or boolean.- Returns:
- true if the base is Object
-
baseIsString
public boolean baseIsString()
-
isString
@Pure public boolean isString()
-
baseIsHashcode
public boolean baseIsHashcode()
-
isHashcode
@Pure public boolean isHashcode()
-
isPointerFileRep
@Pure public boolean isPointerFileRep()
Does this type represent a pointer? Should only be applied to file_rep types.
-
comparableOrSuperclassEitherWay
public boolean comparableOrSuperclassEitherWay(ProglangType other)
Return true if these two types can be sensibly compared to one another, or if one can be cast to the other. For instance, int is castable to long, but boolean is not castable to float, and int is not castable to int[]. This is a reflexive relationship, but not a transitive one because it might not be true for two children of a superclass, even though it's true for the superclass.
-
comparableOrSuperclassOf
public boolean comparableOrSuperclassOf(ProglangType other)
Return true if these two types can be sensibly compared to one another, and if non-integral, whether this could be a superclass of other. A List is comparableOrSuperclassOf to a ArrayList, but not the other way around. This is a transitive method, but not reflexive.
-
is_function_pointer
@Pure public boolean is_function_pointer()
Returns whether or not this declared type is a function pointer Only valid if the front end marks the function pointer with the name '*func'.
-
-