Class Type.InvariantSemantics

Enclosing class:
Type<T>

A Type.VariantSemantics implementation that does not permit subtyping, but that compares wildcard types covariantly.
Author:
Laird Nelson
  • Field Details

  • Constructor Details

  • Method Details

    • assignable

      public <X, Y> boolean assignable(Type<X> receiverType, Type<Y> payloadType)
      Description copied from class: Type.Semantics
      Returns true if and only if a reference bearing the type modeled by the supplied payloadType is assignable to a reference bearing the type modeled by the supplied receiverType, according to the assignability rules modeled by this Type.Semantics instance.
      Overrides:
      assignable in class Type.Semantics
      Type Parameters:
      X - the kind of type modeled by the receiverType; often a java.lang.reflect.Type
      Y - the kind of type modeled by the payloadType; often a java.lang.reflect.Type
      Parameters:
      receiverType - the receiver type as described above; must not be null
      payloadType - the payload type as described above; must not be null
      Returns:
      true if and only if a reference bearing the type modeled by the supplied payloadType is assignable to a reference bearing the type modeled by the supplied receiverType, according to the assignability rules modeled by this Type.Semantics instance; false otherwise