public final class HotSpotResolvedPrimitiveType extends HotSpotResolvedJavaType implements HotSpotProxified
JavaType
for primitive HotSpot types.Modifier and Type | Field and Description |
---|---|
private Kind |
kind |
ANNOTATION, BRIDGE, ENUM, MANDATED, SYNTHETIC, VARARGS
Constructor and Description |
---|
HotSpotResolvedPrimitiveType(Kind kind)
Creates the JVMCI mirror for a primitive
Kind . |
Modifier and Type | Method and Description |
---|---|
ResolvedJavaType |
asExactType()
Returns this type if it is an exact type otherwise returns null.
|
ResolvedJavaField |
findInstanceFieldWithOffset(long offset,
Kind expectedType)
Returns the instance field of this class (or one of its super classes) at the given offset,
or
null if there is no such field. |
Assumptions.AssumptionResult<ResolvedJavaType> |
findLeafConcreteSubtype()
Attempts to get a leaf concrete subclass of this type.
|
ResolvedJavaType |
findLeastCommonAncestor(ResolvedJavaType otherType)
Walks the class hierarchy upwards and returns the least common class that is a superclass of
both the current and the given type.
|
Assumptions.AssumptionResult<ResolvedJavaMethod> |
findUniqueConcreteMethod(ResolvedJavaMethod method)
Given a
ResolvedJavaMethod A, returns a concrete ResolvedJavaMethod B that is
the only possible unique target for a virtual call on A(). |
<T extends Annotation> |
getAnnotation(Class<T> annotationClass)
Returns the annotation for the specified type of this class, if such an annotation is
present.
|
HotSpotResolvedObjectTypeImpl |
getArrayClass()
Gets the array class type representing an array with elements of this type.
|
URL |
getClassFilePath()
Returns the class file path - if available - of this type, or
null . |
ResolvedJavaMethod |
getClassInitializer()
Returns the
<clinit> method for this class if there is one. |
ResolvedJavaType |
getComponentType()
For array types, gets the type of the components, or
null if this is not an array
type. |
ResolvedJavaMethod[] |
getDeclaredConstructors()
Returns an array reflecting all the constructors declared by this type.
|
ResolvedJavaMethod[] |
getDeclaredMethods()
Returns an array reflecting all the methods declared by this type.
|
ResolvedJavaType |
getElementalType()
Gets the elemental type for this given type.
|
ResolvedJavaType |
getEnclosingType()
Returns the enclosing type of this type, if it exists, or
null . |
ResolvedJavaField[] |
getInstanceFields(boolean includeSuperclasses)
Returns the instance fields of this class, including
internal fields.
|
ResolvedJavaType[] |
getInterfaces()
Gets the interfaces implemented or extended by this type.
|
JavaConstant |
getJavaClass()
Gets the runtime representation of the Java class object of this type.
|
Kind |
getKind()
Gets the kind of this type.
|
int |
getModifiers()
Returns the Java Virtual Machine modifiers for this element.
|
JavaConstant |
getObjectHub()
Gets the runtime representation of the "hub" of this type--that is, the closest part of the
type representation which is typically stored in the object header.
|
ResolvedJavaType |
getSingleImplementor()
Gets the single implementor of this type.
|
String |
getSourceFileName()
Returns name of source file of this type.
|
ResolvedJavaField[] |
getStaticFields()
Returns the static fields of this class, including
internal fields.
|
ResolvedJavaType |
getSuperclass()
Gets the super class of this type.
|
Assumptions.AssumptionResult<Boolean> |
hasFinalizableSubclass()
Checks whether this type has any finalizable subclasses so far.
|
boolean |
hasFinalizer()
Checks whether this type has a finalizer method.
|
void |
initialize()
Initializes this type.
|
boolean |
isArray()
Checks whether this type is an array class.
|
boolean |
isAssignableFrom(ResolvedJavaType other)
Determines if this type is either the same as, or is a superclass or superinterface of, the
type represented by the specified parameter.
|
boolean |
isInitialized()
Checks whether this type is initialized.
|
boolean |
isInstance(JavaConstant obj)
Checks whether the specified object is an instance of this type.
|
boolean |
isInstanceClass()
Checks whether this type is an instance class.
|
boolean |
isInterface()
Checks whether this type is an interface.
|
boolean |
isJavaLangObject()
Returns true if this type is exactly the type
Object . |
boolean |
isLinked()
Checks whether this type is linked and verified.
|
boolean |
isLocal()
Returns
true if the type is a local type. |
boolean |
isMember()
Returns
true if the type is a member type. |
boolean |
isPrimitive()
Checks whether this type is primitive.
|
boolean |
isTrustedInterfaceType()
Returns true if this type represents an interface and it should be trusted even in places
where the JVM verifier would not give any guarantees other than
Object . |
Class<?> |
mirror() |
ResolvedJavaType |
resolve(ResolvedJavaType accessingClass)
Resolves this type to a
ResolvedJavaType . |
ResolvedJavaMethod |
resolveConcreteMethod(ResolvedJavaMethod method,
ResolvedJavaType callerType)
Resolves the method implementation for virtual dispatches on objects of this dynamic type.
|
ResolvedJavaMethod |
resolveMethod(ResolvedJavaMethod method,
ResolvedJavaType callerType)
Resolves the method implementation for virtual dispatches on objects of this dynamic type.
|
String |
toString() |
equals, fromClass, hashCode
getName
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
findMethod, isLeaf
getName, getUnqualifiedName, toClassName, toJavaName, toJavaName
isAbstract, isConcrete, isFinalFlagSet, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isTransient, isVolatile, jvmClassModifiers, jvmFieldModifiers, jvmMethodModifiers
public HotSpotResolvedPrimitiveType(Kind kind)
Kind
.
NOTE: Creating an instance of this class does not install the mirror for the
Class
type. Use HotSpotResolvedJavaType.fromClass(Class)
instead.
kind
- the Kind to create the mirror forpublic int getModifiers()
ResolvedJavaType
ResolvedJavaType
) can not be private or protected.
Only the flags specified in the JVM specification will be included in the returned mask. This
method is identical to Class.getModifiers()
in terms of the value return for this
type.
getModifiers
in interface ModifiersProvider
getModifiers
in interface ResolvedJavaType
public HotSpotResolvedObjectTypeImpl getArrayClass()
JavaType
getArrayClass
in interface JavaType
getArrayClass
in interface ResolvedJavaType
public ResolvedJavaType getElementalType()
JavaType
int[][][]
is
int
. A non-array type is its own elemental type.getElementalType
in interface JavaType
getElementalType
in interface ResolvedJavaType
public ResolvedJavaType getComponentType()
JavaType
null
if this is not an array
type. This method is analogous to Class.getComponentType()
.getComponentType
in interface JavaType
getComponentType
in interface ResolvedJavaType
public ResolvedJavaType asExactType()
ResolvedJavaType
asExactType
in interface ResolvedJavaType
null
otherwisepublic ResolvedJavaType getSuperclass()
ResolvedJavaType
Object
class,
an interface, a primitive type, or void, then null is returned. If this object represents an
array class then the type object representing the Object
class is returned.getSuperclass
in interface ResolvedJavaType
public ResolvedJavaType[] getInterfaces()
ResolvedJavaType
Class.getInterfaces()
and as such, only returns the interfaces directly implemented
or extended by this type.getInterfaces
in interface ResolvedJavaType
public ResolvedJavaType getSingleImplementor()
ResolvedJavaType
If the compiler uses the result of this method for its compilation, the usage must be guarded because the verifier can not guarantee that the assigned type really implements this interface. Additionally, class loading can invalidate the result of this method.
getSingleImplementor
in interface ResolvedJavaType
null
if there is no implementor, the implementor if there is only one, or
this
if there are more than one.public ResolvedJavaType findLeastCommonAncestor(ResolvedJavaType otherType)
ResolvedJavaType
findLeastCommonAncestor
in interface ResolvedJavaType
null
if primitive types are involved.public JavaConstant getObjectHub()
ResolvedJavaType
getObjectHub
in interface ResolvedJavaType
public JavaConstant getJavaClass()
ResolvedJavaType
getJavaClass
in interface ResolvedJavaType
public Assumptions.AssumptionResult<Boolean> hasFinalizableSubclass()
ResolvedJavaType
hasFinalizableSubclass
in interface ResolvedJavaType
true
if this class has any subclasses with finalizerspublic boolean hasFinalizer()
ResolvedJavaType
hasFinalizer
in interface ResolvedJavaType
true
if this class has a finalizerpublic boolean isArray()
ResolvedJavaType
isArray
in interface ResolvedJavaType
true
if this type is an array classpublic boolean isPrimitive()
ResolvedJavaType
isPrimitive
in interface ResolvedJavaType
true
if this type is primitivepublic boolean isInitialized()
ResolvedJavaType
linked
and that the static initializer has run.isInitialized
in interface ResolvedJavaType
true
if this type is initializedpublic boolean isLinked()
ResolvedJavaType
initialized
type is always linked.isLinked
in interface ResolvedJavaType
true
if this type is linkedpublic boolean isInstance(JavaConstant obj)
ResolvedJavaType
isInstance
in interface ResolvedJavaType
obj
- the object to testtrue
if the object is an instance of this typepublic boolean isInstanceClass()
ResolvedJavaType
isInstanceClass
in interface ResolvedJavaType
true
if this type is an instance classpublic boolean isInterface()
ResolvedJavaType
isInterface
in interface ModifiersProvider
isInterface
in interface ResolvedJavaType
true
if this type is an interfaceModifier.isInterface(int)
public boolean isAssignableFrom(ResolvedJavaType other)
ResolvedJavaType
Class.isAssignableFrom(Class)
in terms of the value return for this type.isAssignableFrom
in interface ResolvedJavaType
public Kind getKind()
JavaType
public boolean isJavaLangObject()
ResolvedJavaType
Object
.isJavaLangObject
in interface ResolvedJavaType
public ResolvedJavaMethod resolveConcreteMethod(ResolvedJavaMethod method, ResolvedJavaType callerType)
ResolvedJavaType
ResolvedJavaType.findUniqueConcreteMethod(ResolvedJavaMethod)
.resolveConcreteMethod
in interface ResolvedJavaType
method
- the method to select the implementation ofcallerType
- the caller or context type used to perform access checksnull
if there is no
concrete implementation of method
in this type or any of its superclassespublic ResolvedJavaMethod resolveMethod(ResolvedJavaMethod method, ResolvedJavaType callerType)
ResolvedJavaType
resolveMethod
in interface ResolvedJavaType
method
- the method to select the implementation ofcallerType
- the caller or context type used to perform access checksnull
if it can not be
linkedpublic Assumptions.AssumptionResult<ResolvedJavaType> findLeafConcreteSubtype()
ResolvedJavaType
For an array type A, the leaf concrete subclass is A if the
elemental type of A is final (which includes primitive
types). Otherwise null
is returned for A.
For a non-array type T, the result is the leaf concrete type in the current hierarchy of T.
A runtime may decide not to manage or walk a large hierarchy and so the result is conservative. That is, a non-null result is guaranteed to be the leaf concrete class in T's hierarchy at the current point in time but a null result does not necessarily imply that there is no leaf concrete class in T's hierarchy.
If the compiler uses the result of this method for its compilation, it must register the
Assumptions.AssumptionResult
in its Assumptions
because dynamic class loading can
invalidate the result of this method.
findLeafConcreteSubtype
in interface ResolvedJavaType
Assumptions.AssumptionResult
containing the leaf concrete subclass for this type as
described abovepublic Assumptions.AssumptionResult<ResolvedJavaMethod> findUniqueConcreteMethod(ResolvedJavaMethod method)
ResolvedJavaType
ResolvedJavaMethod
A, returns a concrete ResolvedJavaMethod
B that is
the only possible unique target for a virtual call on A(). Returns null
if either no
such concrete method or more than one such method exists. Returns the method A if A is a
concrete method that is not overridden.
If the compiler uses the result of this method for its compilation, it must register an assumption because dynamic class loading can invalidate the result of this method.
findUniqueConcreteMethod
in interface ResolvedJavaType
method
- the method A for which a unique concrete target is searchednull
if no such target exists or assumptions
are not supported by this runtimepublic ResolvedJavaField[] getInstanceFields(boolean includeSuperclasses)
ResolvedJavaType
getInstanceFields
in interface ResolvedJavaType
includeSuperclasses
- if true, then instance fields for the complete hierarchy of this
type are included in the resultpublic ResolvedJavaField[] getStaticFields()
ResolvedJavaType
getStaticFields
in interface ResolvedJavaType
public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
ResolvedJavaType
getAnnotation
in interface ResolvedJavaType
annotationClass
- the Class object corresponding to the annotation typenull
public ResolvedJavaType resolve(ResolvedJavaType accessingClass)
JavaType
ResolvedJavaType
.public void initialize()
ResolvedJavaType
initialize
in interface ResolvedJavaType
public ResolvedJavaField findInstanceFieldWithOffset(long offset, Kind expectedType)
ResolvedJavaType
null
if there is no such field.findInstanceFieldWithOffset
in interface ResolvedJavaType
offset
- the offset of the field to look fornull
if there is no such field.public String getSourceFileName()
ResolvedJavaType
getSourceFileName
in interface ResolvedJavaType
public Class<?> mirror()
mirror
in class HotSpotResolvedJavaType
public URL getClassFilePath()
ResolvedJavaType
null
.getClassFilePath
in interface ResolvedJavaType
public boolean isLocal()
ResolvedJavaType
true
if the type is a local type.isLocal
in interface ResolvedJavaType
public boolean isMember()
ResolvedJavaType
true
if the type is a member type.isMember
in interface ResolvedJavaType
public ResolvedJavaType getEnclosingType()
ResolvedJavaType
null
.getEnclosingType
in interface ResolvedJavaType
public ResolvedJavaMethod[] getDeclaredConstructors()
ResolvedJavaType
Class.getDeclaredConstructors()
in terms of returned constructors.getDeclaredConstructors
in interface ResolvedJavaType
public ResolvedJavaMethod[] getDeclaredMethods()
ResolvedJavaType
Class.getDeclaredMethods()
in terms of returned methods.getDeclaredMethods
in interface ResolvedJavaType
public ResolvedJavaMethod getClassInitializer()
ResolvedJavaType
<clinit>
method for this class if there is one.getClassInitializer
in interface ResolvedJavaType
public boolean isTrustedInterfaceType()
ResolvedJavaType
Object
.isTrustedInterfaceType
in interface ResolvedJavaType