diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java index 5beee6b0d3..f2a95028d4 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java @@ -25,7 +25,13 @@ public class Field { @Nullable private final Deprecation deprecation; - public Field(@Nonnull String wireName, @Nonnull Type type, boolean required, @Nullable String description, @Nullable Deprecation deprecation) { + public Field( + @Nonnull String wireName, + @Nonnull Type type, + boolean required, + @Nullable String description, + @Nullable Deprecation deprecation + ) { this.wireName = Strings.requireNonBlank(wireName, "wireName must not be null"); this.type = Objects.requireNonNull(type, "type must not be null"); this.required = required; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java index d150c64d17..df574fc524 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java @@ -60,7 +60,7 @@ private HttpPath(@Nonnull List parts, @Nullable Deprecation deprecation, @ } public List getParams() { - return parts.stream().filter(Part::isParameter).map(Part::getParameter).toList(); + return parts.stream().filter(Part::isParameter).map(Part::getParameter).collect(Collectors.toList()); } public Set getParamNameSet() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index a65b104618..2c79d9611b 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -14,6 +14,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.codegen.JavaFormatter; @@ -99,7 +100,11 @@ public String getName() { } public Collection getChildren() { - return parent.children.values().stream().filter(n -> !n.operations.isEmpty()).map(n -> new Client(n, async)).toList(); + return parent.children.values() + .stream() + .filter(n -> !n.operations.isEmpty()) + .map(n -> new Client(n, async)) + .collect(Collectors.toList()); } public Collection getOperations() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 7f2e0896c9..ff423e157a 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -20,6 +20,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; +import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; import org.apache.commons.lang3.NotImplementedException; @@ -239,7 +240,7 @@ private void visit(Namespace parent, String className, String typedefName, OpenA shape = new EnumShape( parent, className, - schema.getEnums().orElseThrow().stream().map(EnumShape.Variant::new).toList(), + schema.getEnums().orElseThrow().stream().map(EnumShape.Variant::new).collect(Collectors.toList()), typedefName ); } else if (schema.hasOneOf()) { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java index bce8c752aa..4089e18b3f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java @@ -11,6 +11,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.stream.Collectors; public class TaggedUnionShape extends ObjectShape { private final List variants = new ArrayList<>(); @@ -28,7 +29,7 @@ public Collection getVariants() { } public Collection getPrimitiveVariants() { - return variants.stream().filter(v -> v.getType().isPrimitive()).toList(); + return variants.stream().filter(v -> v.getType().isPrimitive()).collect(Collectors.toList()); } @Override diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpMethod.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpMethod.java index c3ea6f754a..0659e5e725 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpMethod.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/HttpMethod.java @@ -34,7 +34,6 @@ public static HttpMethod from(@Nonnull PathItem.HttpMethod httpMethod) { return from(httpMethod.name().toLowerCase()); } - @Override public String toString() { return name().toLowerCase(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java index e2a514509f..442873eab7 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiParameter.java @@ -48,8 +48,7 @@ protected OpenApiParameter(@Nullable OpenApiElement parent, @Nonnull JsonPoin var extensions = parameter.getExtensions(); this.versionDeprecated = Maps.tryGet(extensions, "x-version-deprecated").map(String::valueOf).orElse(null); this.deprecationMessage = Maps.tryGet(extensions, "x-deprecation-message").map(String::valueOf).orElse(null); - this.isGlobal = (Boolean) Maps.tryGet(extensions, "x-global") - .orElse(null); + this.isGlobal = (Boolean) Maps.tryGet(extensions, "x-global").orElse(null); } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Lists.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Lists.java index 6761de69c7..a388d8c4a6 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Lists.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/Lists.java @@ -37,7 +37,7 @@ public static List transform(@Nonnull List list, @Nonnu public static List transform(@Nonnull List list, @Nonnull ItemMapper function) { Objects.requireNonNull(list, "list must not be null"); Objects.requireNonNull(function, "function must not be null"); - return IntStream.range(0, list.size()).mapToObj(i -> function.map(i, list.get(i))).toList(); + return IntStream.range(0, list.size()).mapToObj(i -> function.map(i, list.get(i))).collect(Collectors.toList()); } @FunctionalInterface diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MavenArtifactResolver.java b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MavenArtifactResolver.java index 7db5fbdd32..99ae98a3db 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MavenArtifactResolver.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/utils/MavenArtifactResolver.java @@ -67,7 +67,7 @@ public Set resolve(boolean withTransitives, @Nonnull Collection ma var dependencies = mavenCoordinates.stream() .map(coord -> new Dependency(new DefaultArtifact(coord), null, null, withTransitives ? null : EXCLUDE_ALL_TRANSITIVES)) - .toList(); + .collect(Collectors.toList()); var request = new DependencyRequest(new CollectRequest(dependencies, null, repositories), null);