Class ReferenceComparisons

java.lang.Object
io.micronaut.sourcegen.bytecode.core.ReferenceComparisons

@Internal public final class ReferenceComparisons extends Object
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
  • 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 operand
      right - The right operand
      Returns:
      The operands and their common type, or null where an operand is a reference, or where the two are a boolean and a number, which javac does not compare