public interface TypeHierarchy
Modifier and Type | Method and Description |
---|---|
boolean |
isSubtype(AnnotatedTypeMirror subtype,
AnnotatedTypeMirror supertype)
Returns true if
subtype is a subtype of or convertible to supertype for all
hierarchies present. |
boolean |
isSubtype(AnnotatedTypeMirror subtype,
AnnotatedTypeMirror supertype,
AnnotationMirror top)
The same as
isSubtype(AnnotatedTypeMirror, AnnotatedTypeMirror) , but only for the
hierarchy of which top is the top. |
boolean isSubtype(AnnotatedTypeMirror subtype, AnnotatedTypeMirror supertype)
subtype
is a subtype of or convertible to supertype
for all
hierarchies present. If the underlying Java type of subtype
is not a subtype of or
convertible to the underlying Java type of supertype
, then the behavior of this
method is undefined.
Ideally, types that require conversions would be converted before isSubtype is called, but instead, isSubtype performs some of these conversions.
JLS 5.1 specifies 13 categories of conversions.
4 categories are converted in isSubtype:
AnnotatedTypes.asSuper(Types,
AnnotatedTypeFactory, AnnotatedTypeMirror, AnnotatedTypeMirror)
which calls AnnotatedTypeFactory.getBoxedType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedPrimitiveType)
AnnotatedTypes.asSuper(Types,
AnnotatedTypeFactory, AnnotatedTypeMirror, AnnotatedTypeMirror)
which calls AnnotatedTypeFactory.getUnboxedType(org.checkerframework.framework.type.AnnotatedTypeMirror.AnnotatedDeclaredType)
AnnotatedTypes.asSuper(javax.lang.model.util.Types, org.checkerframework.framework.type.AnnotatedTypeFactory, org.checkerframework.framework.type.AnnotatedTypeMirror, org.checkerframework.framework.type.AnnotatedTypeMirror)
which calls AnnotatedTypeFactory.getStringType(AnnotatedTypeMirror)
subtype
- possible subtypesupertype
- possible supertypesubtype
is a subtype of supertype
for all hierarchies
present.boolean isSubtype(AnnotatedTypeMirror subtype, AnnotatedTypeMirror supertype, AnnotationMirror top)
isSubtype(AnnotatedTypeMirror, AnnotatedTypeMirror)
, but only for the
hierarchy of which top
is the top.subtype
- possible subtypesupertype
- possible supertypetop
- the qualifier at the top of the hierarchy for which the subtype check should be
preformedsubtype
is a subtype of supertype
in the qualifier
hierarchy whose top is top