public static UEnhancedForLoop create(
      UVariableDecl variable, UExpression elements, UStatement statement) {
    // On JDK 20 and above the `EnhancedForLoopTree` interface contains a additional method
    // `getDeclarationKind()`, referencing a  type not available prior to JDK 20. AutoValue
    // generates a corresponding field and accessor for this property. Here we find and invoke the
    // generated constructor with the appropriate arguments, depending on context.
    // See https://github.com/openjdk/jdk20/commit/2cb64a75578ccc15a1dfc8c2843aa11d05ca8aa7.
    // TODO: Simplify this logic once JDK 19 and older are no longer supported.
    return isCompiledWithJdk20Plus()
        ? createJdk20PlusEnhancedForLoop(variable, elements, statement)
        : createPreJdk20EnhancedForLoop(variable, elements, statement);
  }
@Test
  public void equality() {
    new EqualsTester()
        .addEqualityGroup(
            UEnhancedForLoop.create(
                UVariableDecl.create("c", UPrimitiveTypeTree.CHAR, null),
                UMethodInvocation.create(
                    UMemberSelect.create(
                        ULiteral.stringLit("foo"),
                        "toCharArray",
                        UMethodType.create(UArrayType.create(UPrimitiveType.CHAR)))),
                USkip.INSTANCE))
        .addEqualityGroup(
            UEnhancedForLoop.create(
                UVariableDecl.create("c", UClassIdent.create("java.lang.Character"), null),
                UMethodInvocation.create(
                    UMemberSelect.create(
                        ULiteral.stringLit("foo"),
                        "toCharArray",
                        UMethodType.create(UArrayType.create(UPrimitiveType.CHAR)))),
                USkip.INSTANCE))
        .testEquals();
  }