Class ConformanceFlags
- java.lang.Object
-
- org.eclipse.xtext.xbase.typesystem.conformance.ConformanceFlags
-
public final class ConformanceFlags extends java.lang.ObjectThe bits that are used to indicate conformance levels during type computation.
-
-
Field Summary
Fields Modifier and Type Field Description static intBOXINGIf boxing conversion was necessary, this bit is set.static intCHECK_RESULTSFlags that describe the result of a checked conformance, which can be one ofINCOMPATIBLE,SUCCESS,LAMBDA_RAW_COMPATIBLE, orLAMBDA_PARAMETER_COMPATIBLE.static intCHECKEDConformance has been checked.static intCHECKED_SUCCESSDefault flags to announce a successfully checked conformance.static intDEMAND_CONVERSIONIf the result has this bit set, a demand conversion had to be applied to make both types compatible.static intEXPLICIT_VOID_RETURNUsed to indicate an explicit void return valuestatic intINCOMPATIBLEIndicates incompatibility.static intLAMBDA_PARAMETER_COMPATIBLELambda expression is compatible to its expectation by its parameter types but not by its result.static intLAMBDA_RAW_COMPATIBLELambda expression is raw compatible to its expectation.static intLAMBDA_VOID_COMPATIBLEA lambda's last expression has a non-void implicit type but void was expected.static intLAMBDA_WITH_EXPECTATIONA lambda's type was computed with a valid expectation (a functional interface / SAM type was expected).static intMERGEDFlags have been merged from various sources.static intNO_IMPLICIT_RETURNIndicates that the announced type is not an implicit return type.static intNONENo flags given.static intPREFERRED_LAMBDA_SUGARA method is overloaded with various function interfaces.static intPRIMITIVE_WIDENINGThis is set if primitive widening had to be applied.static intPROPAGATED_TYPEIndicates that the type of this expression is derived from a child which can provide better conformance information.static intRAW_TYPEIndicates that the types have been checked as if they were raw types.static intRAW_TYPE_CONVERSIONThis is set if the conformance was possible due to raw type conversion.static intSEALEDConformance has been checked and the result was sealed.static intSUBTYPEIndicates that both types are in a subtype relationship.static intSUCCESSThis bit indicates a successful check for conformance.static intSYNONYMIf a synonym conversion was necessary, this bit is set in the result value.static intTHROWN_EXCEPTIONIndicates that the expression will definitely throw an exception.static intUNBOXINGIf unboxing conversion was necessary, this bit is set.static intUNCHECKEDConformance was not yet checked.static intUNKNOWN_TYPE_PARTICIPATEDTwo types are considered compatible if one of the participants is the unknown type.static intVAR_ARGUsed 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 intcompareFlags(int left, int right)Simple comparison of two flags.static booleansanityCheck(int flags)Simple sanity check for the given flags.static java.lang.StringtoString(int flags)Prints the names of the set bits as a list, e.g.
-
-
-
Field Detail
-
NONE
public static final int NONE
No flags given.- See Also:
- Constant Field Values
-
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 aSYNONYMmay 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
-
CHECKED
public static final int CHECKED
Conformance has been checked.- 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
-
CHECK_RESULTS
public static final int CHECK_RESULTS
Flags that describe the result of a checked conformance, which can be one ofINCOMPATIBLE,SUCCESS,LAMBDA_RAW_COMPATIBLE, orLAMBDA_PARAMETER_COMPATIBLE.- 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-1for the left,1for the right or0if 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 alwaystruesuch that it can be used in Java assertions. Will throw anIllegalArgumentExceptionif the flags appear to be bogus.
-
-