APIdia Launch Partner
Top Description Fields Constructors Methods
sun.jvm.hotspot.types.basic

public Class BasicType

extends Object
implements Type
Class Inheritance
All Implemented Interfaces
sun.jvm.hotspot.types.Type
Known Direct Subclasses
sun.jvm.hotspot.types.basic.BasicCIntegerType, sun.jvm.hotspot.types.basic.BasicPointerType
Imports
java.util.*, sun.jvm.hotspot.debugger.*, sun.jvm.hotspot.types.*, sun.jvm.hotspot.utilities.*

This is a basic implementation of the Type interface which should be complete enough to be portable across platforms. The only issue will be the construction of these objects and their components from the platform-specific debugging information; see BasicTypeDataBase.

There are two types of clients of this class. The first is that which builds the TypeDatabase. This kind of client uses the additional public methods beyond those in the Type interface to properly configure the BasicType objects. The second is the consumer of these types; this kind of client should deal only with the Type interfaces.

Field Summary

Modifier and TypeField and Description
protected BasicTypeDataBase
private List<Field>
private boolean
private boolean
private String
private Map<String, Field>
private long
private Type

Constructor Summary

AccessConstructor and Description
public
BasicType(BasicTypeDataBase db, String name, Type superclass)

superclass may be null

public
BasicType(BasicTypeDataBase db, String name)

Equivalent to BasicType(db, name, null)

Method Summary

Modifier and TypeMethod and Description
public void
addField(Field field)

This method should only be used by the builder of the TypeDataBase.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public AddressField
public CIntegerField
public Field
getField(String fieldName, boolean searchSuperclassFields, boolean throwExceptionIfNotFound)

Implements sun.jvm.hotspot.types.Type.getField.

This is permissive and returns the CField regardless of its type as long as it is present.

public Field
getField(String fieldName, boolean searchSuperclassFields)

Implements sun.jvm.hotspot.types.Type.getField.

This is permissive and returns the CField regardless of its type as long as it is present -- it is equivalent to getField(fieldName, searchSuperclassFields, true).

public Field
getField(String fieldName)

Implements sun.jvm.hotspot.types.Type.getField.

This is permissive and returns the CField regardless of its type as long as it is present.

public Field
getField(String fieldName, Type declaredType, boolean searchSuperclassFields)

Implements sun.jvm.hotspot.types.Type.getField.

If there is a mismatch between the declared type and the type which would otherwise be returned from this routine, it throws a WrongTypeException.

public Field
getField(String fieldName, Type declaredType)

Implements sun.jvm.hotspot.types.Type.getField.

If there is a mismatch between the declared type and the type which would otherwise be returned from this routine, it throws a WrongTypeException.

public Iterator<E>
getFields()

Implements sun.jvm.hotspot.types.Type.getFields.

The returned iterator's "remove" method must not be called

public JBooleanField
getJBooleanField(String fieldName)

Implements sun.jvm.hotspot.types.Type.getJBooleanField.

These accessors are designed to allow strong type checking of certain well-known types of fields, specifically Java primitive and oop types.

public JByteField
public JCharField
public JDoubleField
public JFloatField
public JIntField
public JLongField
public JShortField
public String
public NarrowOopField
public OopField
public long
getSize()

Implements sun.jvm.hotspot.types.Type.getSize.

The size in bytes, at the machine level, of this type.

public Type
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isCIntegerType()

Implements sun.jvm.hotspot.types.Type.isCIntegerType.

Overridden by BasicCIntegerType

public boolean
isCStringType()

Implements sun.jvm.hotspot.types.Type.isCStringType.

Indicates whether this type is const char*.

public boolean
isJavaPrimitiveType()

Implements sun.jvm.hotspot.types.Type.isJavaPrimitiveType.

Indicates whether this type is one of the Java primitive types.

public boolean
isOopType()

Implements sun.jvm.hotspot.types.Type.isOopType.

Indicates whether this type is an oop type in the VM.

public boolean
isPointerType()

Implements sun.jvm.hotspot.types.Type.isPointerType.

Overridden by BasicPointerType

public void
removeField(Field field)

This method should only be used by the builder of the TypeDataBase.

public void
setIsJavaPrimitiveType(boolean isJavaPrimitiveType)

This should only be called at most once, and only by the builder of the type database

public void
setIsOopType(boolean isOopType)

This should only be called at most once, and only by the builder of the type database

public void
setSize(long sizeInBytes)

This should only be called at most once, and only by the builder of the type database

public void
setSuperclass(Type superclass)

This should only be called at most once, and only by the builder of the type database

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

dbback to summary
protected BasicTypeDataBase db
fieldListback to summary
private List<Field> fieldList
isJavaPrimitiveTypeback to summary
private boolean isJavaPrimitiveType
isOopTypeback to summary
private boolean isOopType
nameback to summary
private String name
nameToFieldMapback to summary
private Map<String, Field> nameToFieldMap
sizeback to summary
private long size
superclassback to summary
private Type superclass

Constructor Detail

BasicTypeback to summary
public BasicType(BasicTypeDataBase db, String name, Type superclass)

superclass may be null

BasicTypeback to summary
public BasicType(BasicTypeDataBase db, String name)

Equivalent to BasicType(db, name, null)

Method Detail

addFieldback to summary
public void addField(Field field)

This method should only be used by the builder of the TypeDataBase. Throws a RuntimeException if a field with this name was already present in this class.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

getAddressFieldback to summary
public AddressField getAddressField(String fieldName)

Implements sun.jvm.hotspot.types.Type.getAddressField.

getCIntegerFieldback to summary
public CIntegerField getCIntegerField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getCIntegerField.

getFieldback to summary
public Field getField(String fieldName, boolean searchSuperclassFields, boolean throwExceptionIfNotFound)

Implements sun.jvm.hotspot.types.Type.getField.

Doc from sun.jvm.hotspot.types.Type.getField.

This is permissive and returns the CField regardless of its type as long as it is present. Returns null if the field was not found, unless throwExceptionIfNotFound is true, in which case a RuntimeException is thrown (for debugging purposes).

getFieldback to summary
public Field getField(String fieldName, boolean searchSuperclassFields)

Implements sun.jvm.hotspot.types.Type.getField.

Doc from sun.jvm.hotspot.types.Type.getField.

This is permissive and returns the CField regardless of its type as long as it is present -- it is equivalent to getField(fieldName, searchSuperclassFields, true). Throws a RuntimeException if the field was not found.

getFieldback to summary
public Field getField(String fieldName)

Implements sun.jvm.hotspot.types.Type.getField.

Doc from sun.jvm.hotspot.types.Type.getField.

This is permissive and returns the CField regardless of its type as long as it is present. This does not search superclasses' fields; it is equivalent to getField(fieldName, false). Throws a RuntimeException if the field was not found.

getFieldback to summary
public Field getField(String fieldName, Type declaredType, boolean searchSuperclassFields) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getField.

Doc from sun.jvm.hotspot.types.Type.getField.

If there is a mismatch between the declared type and the type which would otherwise be returned from this routine, it throws a WrongTypeException. declaredType must not be null. Throws a RuntimeException if field was otherwise not found.

getFieldback to summary
public Field getField(String fieldName, Type declaredType) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getField.

Doc from sun.jvm.hotspot.types.Type.getField.

If there is a mismatch between the declared type and the type which would otherwise be returned from this routine, it throws a WrongTypeException. declaredType must not be null. This does not search superclasses' fields; it is equivalent to getField(fieldName, declaredType, false). Throws a RuntimeException if field was otherwise not found.

getFieldsback to summary
public Iterator<E> getFields()

Implements sun.jvm.hotspot.types.Type.getFields.

The returned iterator's "remove" method must not be called

getJBooleanFieldback to summary
public JBooleanField getJBooleanField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJBooleanField.

Doc from sun.jvm.hotspot.types.Type.getJBooleanField.

These accessors are designed to allow strong type checking of certain well-known types of fields, specifically Java primitive and oop types. Specialized fields for all primitive types, as well as oop fields, are required to have strong type checking and a WrongTypeException should be thrown if the given field is not precisely of the given type. Address and Oop fields are more permissive to reduce the complexity of the initial implementation.

These accessors do not search the superclass's fields.

getJByteFieldback to summary
public JByteField getJByteField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJByteField.

getJCharFieldback to summary
public JCharField getJCharField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJCharField.

getJDoubleFieldback to summary
public JDoubleField getJDoubleField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJDoubleField.

getJFloatFieldback to summary
public JFloatField getJFloatField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJFloatField.

getJIntFieldback to summary
public JIntField getJIntField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJIntField.

getJLongFieldback to summary
public JLongField getJLongField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJLongField.

getJShortFieldback to summary
public JShortField getJShortField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getJShortField.

getNameback to summary
public String getName()

Implements sun.jvm.hotspot.types.Type.getName.

getNarrowOopFieldback to summary
public NarrowOopField getNarrowOopField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getNarrowOopField.

getOopFieldback to summary
public OopField getOopField(String fieldName) throws WrongTypeException

Implements sun.jvm.hotspot.types.Type.getOopField.

getSizeback to summary
public long getSize()

Implements sun.jvm.hotspot.types.Type.getSize.

Doc from sun.jvm.hotspot.types.Type.getSize.

The size in bytes, at the machine level, of this type. This should be equivalent to the sizeof operator -- i.e., should include any compiler-inserted fields like the vtbl for C++ types.

getSuperclassback to summary
public Type getSuperclass()

Implements sun.jvm.hotspot.types.Type.getSuperclass.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
isCIntegerTypeback to summary
public boolean isCIntegerType()

Implements sun.jvm.hotspot.types.Type.isCIntegerType.

Overridden by BasicCIntegerType

isCStringTypeback to summary
public boolean isCStringType()

Implements sun.jvm.hotspot.types.Type.isCStringType.

Doc from sun.jvm.hotspot.types.Type.isCStringType.

Indicates whether this type is const char*.

isJavaPrimitiveTypeback to summary
public boolean isJavaPrimitiveType()

Implements sun.jvm.hotspot.types.Type.isJavaPrimitiveType.

Doc from sun.jvm.hotspot.types.Type.isJavaPrimitiveType.

Indicates whether this type is one of the Java primitive types.

isOopTypeback to summary
public boolean isOopType()

Implements sun.jvm.hotspot.types.Type.isOopType.

Doc from sun.jvm.hotspot.types.Type.isOopType.

Indicates whether this type is an oop type in the VM.

isPointerTypeback to summary
public boolean isPointerType()

Implements sun.jvm.hotspot.types.Type.isPointerType.

Overridden by BasicPointerType

removeFieldback to summary
public void removeField(Field field)

This method should only be used by the builder of the TypeDataBase. Throws a RuntimeException if a field with this name was not present in this class.

setIsJavaPrimitiveTypeback to summary
public void setIsJavaPrimitiveType(boolean isJavaPrimitiveType)

This should only be called at most once, and only by the builder of the type database

setIsOopTypeback to summary
public void setIsOopType(boolean isOopType)

This should only be called at most once, and only by the builder of the type database

setSizeback to summary
public void setSize(long sizeInBytes)

This should only be called at most once, and only by the builder of the type database

setSuperclassback to summary
public void setSuperclass(Type superclass)

This should only be called at most once, and only by the builder of the type database

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.