public interface TypeConstraint
TypeConstraints.TOP
and TypeConstraints.BOTTOM
elements, as well as join(TypeConstraint)
and meet(TypeConstraint)
operations.
Besides TOP and BOTTOM there are two types of constrains: TypeConstraint.Exact
(value is known to have exactly some JVM type)
and TypeConstraint.Constrained
(value is instanceof zero or more JVM types and not instanceof zero or more JVM types).
value is instance of some type and value is not an instance of some type.
Null or primitive types are not handled here.Modifier and Type | Interface and Description |
---|---|
static class |
TypeConstraint.Constrained
A non-exact, constrained type
|
static interface |
TypeConstraint.Exact
Represents an exact type.
|
Modifier and Type | Method and Description |
---|---|
default DfType |
asDfType() |
static TypeConstraint |
fromDfType(DfType type) |
default java.lang.String |
getAssignabilityExplanation(TypeConstraint otherType,
boolean expectedAssignable) |
default java.lang.String |
getPresentationText(PsiType type) |
default PsiType |
getPsiType(Project project) |
default <any> |
instanceOfTypes() |
default boolean |
isComparedByEquals() |
default boolean |
isExact() |
boolean |
isSuperConstraintOf(TypeConstraint other) |
TypeConstraint |
join(TypeConstraint other) |
TypeConstraint |
meet(TypeConstraint other) |
default <any> |
notInstanceOfTypes() |
default java.lang.String |
toShortString() |
default TypeConstraint |
tryNegate() |
TypeConstraint join(TypeConstraint other)
other
- other constraint to join withTypeConstraint meet(TypeConstraint other)
other
- other constraint to meet withboolean isSuperConstraintOf(TypeConstraint other)
other
- other constraint to checkdefault TypeConstraint tryNegate()
default PsiType getPsiType(Project project)
project
- current projectdefault java.lang.String getPresentationText(PsiType type)
type
- declared PsiType of the valuedefault boolean isExact()
default boolean isComparedByEquals()
default java.lang.String getAssignabilityExplanation(TypeConstraint otherType, boolean expectedAssignable)
otherType
- other typeexpectedAssignable
- whether other type is expected to be assignable from this, or notdefault <any> instanceOfTypes()
default <any> notInstanceOfTypes()
default DfType asDfType()
DfType
that represents any object that satisfies this constraint, or null (nullability is unknown)default java.lang.String toShortString()
static TypeConstraint fromDfType(DfType type)
type
- DfType
to extract TypeConstraint
from