Enum TypeOps.Convertibility

    • Enum Constant Detail

      • UNCHECKED_WARNING

        public static final TypeOps.Convertibility UNCHECKED_WARNING
        T is not a subtype of S, but every time T is used in a context where an S is expected, unchecked conversion converts the T to an S with a mandated warning. For example the raw type Class is convertible to Class<String> with an unchecked warning.
      • UNCHECKED_NO_WARNING

        public static final TypeOps.Convertibility UNCHECKED_NO_WARNING
        T <: |S| and T </: S, but S is parameterized with only unbounded wildcards. This is a special case of unchecked conversion that produces no warning. We keep it distinct from subtyping to help some algorithms that require subtyping to be a partial order.

        For example, List<String> is a subtype of the raw Collection, not a subtype of Collection<?>, but it is still convertible without warning.

      • SUBTYPING

        public static final TypeOps.Convertibility SUBTYPING
        T is a subtype of S (T <: S). In particular, any type is a subtype of itself (T <: T).

        For example, int can be widened to long, so we consider int <: long.

    • Method Detail

      • values

        public static TypeOps.Convertibility[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (TypeOps.Convertibility c : TypeOps.Convertibility.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TypeOps.Convertibility valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • never

        public boolean never()
        Returns true if this is NEVER.
      • somehow

        public boolean somehow()
        Returns true if this is anything but NEVER.
      • bySubtyping

        public boolean bySubtyping()
        True if this is SUBTYPING.
      • withUncheckedWarning

        public boolean withUncheckedWarning()
        True if this is UNCHECKED_WARNING.