Class ConformanceFlags


  • public final class ConformanceFlags
    extends java.lang.Object
    The bits that are used to indicate conformance levels during type computation.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int BOXING
      If boxing conversion was necessary, this bit is set.
      static int CHECK_RESULTS
      Flags that describe the result of a checked conformance, which can be one of INCOMPATIBLE, SUCCESS, LAMBDA_RAW_COMPATIBLE, or LAMBDA_PARAMETER_COMPATIBLE.
      static int CHECKED
      Conformance has been checked.
      static int CHECKED_SUCCESS
      Default flags to announce a successfully checked conformance.
      static int DEMAND_CONVERSION
      If the result has this bit set, a demand conversion had to be applied to make both types compatible.
      static int EXPLICIT_VOID_RETURN
      Used to indicate an explicit void return value
      static int INCOMPATIBLE
      Indicates incompatibility.
      static int LAMBDA_PARAMETER_COMPATIBLE
      Lambda expression is compatible to its expectation by its parameter types but not by its result.
      static int LAMBDA_RAW_COMPATIBLE
      Lambda expression is raw compatible to its expectation.
      static int LAMBDA_VOID_COMPATIBLE
      A lambda's last expression has a non-void implicit type but void was expected.
      static int LAMBDA_WITH_EXPECTATION
      A lambda's type was computed with a valid expectation (a functional interface / SAM type was expected).
      static int MERGED
      Flags have been merged from various sources.
      static int NO_IMPLICIT_RETURN
      Indicates that the announced type is not an implicit return type.
      static int NONE
      No flags given.
      static int PREFERRED_LAMBDA_SUGAR
      A method is overloaded with various function interfaces.
      static int PRIMITIVE_WIDENING
      This is set if primitive widening had to be applied.
      static int PROPAGATED_TYPE
      Indicates that the type of this expression is derived from a child which can provide better conformance information.
      static int RAW_TYPE
      Indicates that the types have been checked as if they were raw types.
      static int RAW_TYPE_CONVERSION
      This is set if the conformance was possible due to raw type conversion.
      static int SEALED
      Conformance has been checked and the result was sealed.
      static int SUBTYPE
      Indicates that both types are in a subtype relationship.
      static int SUCCESS
      This bit indicates a successful check for conformance.
      static int SYNONYM
      If a synonym conversion was necessary, this bit is set in the result value.
      static int THROWN_EXCEPTION
      Indicates that the expression will definitely throw an exception.
      static int UNBOXING
      If unboxing conversion was necessary, this bit is set.
      static int UNCHECKED
      Conformance was not yet checked.
      static int UNKNOWN_TYPE_PARTICIPATED
      Two types are considered compatible if one of the participants is the unknown type.
      static int VAR_ARG
      Used to indicate a necessary var arg conversion, e.g an expression will be wrapped into an array by the compiler.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compareFlags​(int left, int right)
      Simple comparison of two flags.
      static boolean sanityCheck​(int flags)
      Simple sanity check for the given flags.
      static java.lang.String toString​(int flags)
      Prints the names of the set bits as a list, e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RAW_TYPE

        public static final int RAW_TYPE
        Indicates that the types have been checked as if they were raw types.
        See Also:
        Constant Field Values
      • SUCCESS

        public static final int SUCCESS
        This bit indicates a successful check for conformance.
        See Also:
        Constant Field Values
      • DEMAND_CONVERSION

        public static final int DEMAND_CONVERSION
        If the result has this bit set, a demand conversion had to be applied to make both types compatible. This is especially interesting for function types. Also a SYNONYM may require a demand conversion.
        See Also:
        Constant Field Values
      • SUBTYPE

        public static final int SUBTYPE
        Indicates that both types are in a subtype relationship.
        See Also:
        Constant Field Values
      • PRIMITIVE_WIDENING

        public static final int PRIMITIVE_WIDENING
        This is set if primitive widening had to be applied.
        See Also:
        Constant Field Values
      • UNBOXING

        public static final int UNBOXING
        If unboxing conversion was necessary, this bit is set.
        See Also:
        Constant Field Values
      • BOXING

        public static final int BOXING
        If boxing conversion was necessary, this bit is set.
        See Also:
        Constant Field Values
      • RAW_TYPE_CONVERSION

        public static final int RAW_TYPE_CONVERSION
        This is set if the conformance was possible due to raw type conversion.
        See Also:
        Constant Field Values
      • SYNONYM

        public static final int SYNONYM
        If a synonym conversion was necessary, this bit is set in the result value.
        See Also:
        Constant Field Values
      • UNKNOWN_TYPE_PARTICIPATED

        public static final int UNKNOWN_TYPE_PARTICIPATED
        Two types are considered compatible if one of the participants is the unknown type. This flag indicates this situation.
        See Also:
        Constant Field Values
      • INCOMPATIBLE

        public static final int INCOMPATIBLE
        Indicates incompatibility.
        See Also:
        Constant Field Values
      • VAR_ARG

        public static final int VAR_ARG
        Used to indicate a necessary var arg conversion, e.g an expression will be wrapped into an array by the compiler.
        See Also:
        Constant Field Values
      • SEALED

        public static final int SEALED
        Conformance has been checked and the result was sealed.
        See Also:
        Constant Field Values
      • UNCHECKED

        public static final int UNCHECKED
        Conformance was not yet checked.
        See Also:
        Constant Field Values
      • LAMBDA_RAW_COMPATIBLE

        public static final int LAMBDA_RAW_COMPATIBLE
        Lambda expression is raw compatible to its expectation.
        See Also:
        Constant Field Values
      • LAMBDA_PARAMETER_COMPATIBLE

        public static final int LAMBDA_PARAMETER_COMPATIBLE
        Lambda expression is compatible to its expectation by its parameter types but not by its result.
        See Also:
        Constant Field Values
      • MERGED

        public static final int MERGED
        Flags have been merged from various sources.
        See Also:
        Constant Field Values
      • NO_IMPLICIT_RETURN

        public static final int NO_IMPLICIT_RETURN
        Indicates that the announced type is not an implicit return type. E.g. the type of a return expression is 'void' but this is not the implicit return type of the return expression itself. The return type was computed properly from the children of the return expression.
        See Also:
        Constant Field Values
      • EXPLICIT_VOID_RETURN

        public static final int EXPLICIT_VOID_RETURN
        Used to indicate an explicit void return value
        See Also:
        Constant Field Values
      • PROPAGATED_TYPE

        public static final int PROPAGATED_TYPE
        Indicates that the type of this expression is derived from a child which can provide better conformance information.
        See Also:
        Constant Field Values
      • THROWN_EXCEPTION

        public static final int THROWN_EXCEPTION
        Indicates that the expression will definitely throw an exception.
        See Also:
        Constant Field Values
      • PREFERRED_LAMBDA_SUGAR

        public static final int PREFERRED_LAMBDA_SUGAR
        A method is overloaded with various function interfaces. The variant with a single-arg lambda is the prefered sugar version.
        See Also:
        Constant Field Values
      • LAMBDA_VOID_COMPATIBLE

        public static final int LAMBDA_VOID_COMPATIBLE
        A lambda's last expression has a non-void implicit type but void was expected.
        See Also:
        Constant Field Values
      • LAMBDA_WITH_EXPECTATION

        public static final int LAMBDA_WITH_EXPECTATION
        A lambda's type was computed with a valid expectation (a functional interface / SAM type was expected).
        See Also:
        Constant Field Values
      • CHECKED_SUCCESS

        public static final int CHECKED_SUCCESS
        Default flags to announce a successfully checked conformance.
        See Also:
        Constant Field Values
    • Method Detail

      • compareFlags

        public static int compareFlags​(int left,
                                       int right)
        Simple comparison of two flags. If both indicate compatibility, the one with the better compatibility level wins. Returns -1 for the left, 1 for the right or 0 if undecided.
      • toString

        public static java.lang.String toString​(int flags)
        Prints the names of the set bits as a list, e.g. [CHECKED, SUCCESS].
      • sanityCheck

        public static boolean sanityCheck​(int flags)
        Simple sanity check for the given flags. Returns always true such that it can be used in Java assertions. Will throw an IllegalArgumentException if the flags appear to be bogus.