|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object checkers.types.TypeHierarchy
public class TypeHierarchy extends Object
Class to test AnnotatedTypeMirror
subtype relationships.
This implementation uses the regular Java subtyping rules.
More specifically, let
<: be the subtyping relationship,
qual(A) = qualifier on A
, and
|A| = type without qualifier
:
Note that the array subtyping rules depends on a runtime check to guarantee the soundness of the type system. It is unsafe for static check purposes.
Constructor and Description |
---|
TypeHierarchy(QualifierHierarchy qualifierHierarchy)
Constructs an instance of TypeHierarchy for the type system
whose qualifiers represented in qualifierHierarchy. |
Modifier and Type | Method and Description |
---|---|
boolean |
isSubtype(AnnotatedTypeMirror rhs,
AnnotatedTypeMirror lhs)
Entry point for subtype checking: Checks whether rhs is a subtype of lhs. |
protected boolean |
isSubtypeAsArrayComponent(AnnotatedTypeMirror rhs,
AnnotatedTypeMirror lhs)
Checks that rhs is a subtype of lhs, as an array component type. |
protected boolean |
isSubtypeAsTypeArgument(AnnotatedTypeMirror rhs,
AnnotatedTypeMirror lhs)
Checks that rhs is a subtype of lhs, as actual type arguments. |
protected boolean |
isSubtypeTypeArguments(AnnotatedTypeMirror.AnnotatedDeclaredType rhs,
AnnotatedTypeMirror.AnnotatedDeclaredType lhs)
Checks that rhs and lhs are subtypes with respect to type arguments only. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TypeHierarchy(QualifierHierarchy qualifierHierarchy)
TypeHierarchy
for the type system
whose qualifiers represented in qualifierHierarchy.
qualifierHierarchy
- Method Detail |
---|
public final boolean isSubtype(AnnotatedTypeMirror rhs, AnnotatedTypeMirror lhs)
protected boolean isSubtypeTypeArguments(AnnotatedTypeMirror.AnnotatedDeclaredType rhs, AnnotatedTypeMirror.AnnotatedDeclaredType lhs)
As an implementation detail, this method uses
isSubtypeAsTypeArgument(AnnotatedTypeMirror, AnnotatedTypeMirror)
to compare each type argument individually. Subclasses may override
either methods to allow type argument to change covariantly.
protected boolean isSubtypeAsTypeArgument(AnnotatedTypeMirror rhs, AnnotatedTypeMirror lhs)
protected boolean isSubtypeAsArrayComponent(AnnotatedTypeMirror rhs, AnnotatedTypeMirror lhs)
This property of arrays makes the code unsafe at run-time. Subclasses may override this method to enforce a stricter relationship.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |