Class ReferenceComparisons
java.lang.Object
io.micronaut.sourcegen.bytecode.core.ReferenceComparisons
The referential comparisons (
== and !=) of two primitives, which both bytecode writers compare as
javac compares them: the values, promoted to a common type (JLS 5.6, binary numeric promotion) - a long
compared with a float is compared as a float, and a char with a byte as an
int. The model boxes the operands of an ExpressionDef.EqualsReferentially to Object; a
primitive it boxed is compared as the primitive, as the Java source writes it.- Since:
- 2.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordTwo primitive operands compared as their values: each one is written, then converted to the common type. -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ReferenceComparisons.PrimitiveComparisonprimitiveComparison(ExpressionDef left, ExpressionDef right) The comparison of the values of two primitive operands of a referential comparison.
-
Method Details
-
primitiveComparison
public static @Nullable ReferenceComparisons.PrimitiveComparison primitiveComparison(ExpressionDef left, ExpressionDef right) The comparison of the values of two primitive operands of a referential comparison.- Parameters:
left- The left operandright- The right operand- Returns:
- The operands and their common type, or
nullwhere an operand is a reference, or where the two are abooleanand a number, which javac does not compare
-