Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ public EntriesOrder(final String fields) {
if (fields == null || fields.isEmpty()) {
fieldsOrder = new OrderedMap<>(Function.identity());
} else {
final List<String> fieldList = Arrays.stream(fields.split(",")).collect(Collectors.toList());
final List<String> fieldList = Arrays.stream(fields.split(",")).toList();
fieldsOrder = new OrderedMap<>(Function.identity(), fieldList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ void orderedMapTest() {

container.addValue(f1);
container.addValue(f2);
List<String> entries = container.streams().collect(Collectors.toList());
List<String> entries = container.streams().toList();
Assertions.assertSame("f1", entries.get(0));
Assertions.assertSame("f2", entries.get(1));

container.swap("f1", "f2");
List<String> entries2 = container.streams().collect(Collectors.toList());
List<String> entries2 = container.streams().toList();
Assertions.assertSame("f2", entries2.get(0));
Assertions.assertSame("f1", entries2.get(1));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.talend.sdk.component.form.api;

import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;

import java.util.ArrayList;
Expand Down Expand Up @@ -113,7 +112,7 @@ public CompletionStage<Ui> convert(final String family, final String lang, final
prop.getName(), prop.getDisplayName(), prop.getType(), prop.getDefaultValue(),
prop.getValidation(), prop.getMetadata(), prop.getPlaceholder(),
prop.getProposalDisplayNames()))
.collect(toList());
.toList();
isRootProperty = p -> p.getPath().equals(def.getName());
} else {
props = node.getProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.talend.sdk.component.form.internal.converter.impl;

import static java.util.Collections.singletonMap;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;

import java.util.Collection;
Expand Down Expand Up @@ -115,7 +114,7 @@ public CompletionStage<PropertyContext<?>> convert(final CompletionStage<Propert
.stream()
.filter(prop -> prop.getPath().startsWith(nestedPrefix)
&& prop.getPath().indexOf('.', from) < 0)
.collect(toList());
.toList();
if (!nested.isEmpty()) {
return new ObjectArrayWidgetConverter(schemas, properties, actions, family,
client, gridLayoutFilter, jsonSchema, lang, customConverters, metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.talend.sdk.component.form.internal.converter.impl.schema;

import static java.util.Locale.ROOT;
import static java.util.stream.Collectors.toList;

import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -50,7 +49,7 @@ public CompletionStage<PropertyContext<?>> convert(final CompletionStage<Propert
jsonSchema.setType(context.getProperty().getType().toLowerCase(ROOT));
final String prefix = context.getProperty().getPath() + "[]";
final List<SimplePropertyDefinition> arrayElements =
properties.stream().filter(child -> child.getPath().startsWith(prefix)).collect(toList());
properties.stream().filter(child -> child.getPath().startsWith(prefix)).toList();

if (arrayElements.stream().anyMatch(e -> e.getPath().startsWith(prefix + '.'))) { // complex object
final JsonSchema items = new JsonSchema();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected <T> CompletionStage<List<UiSchema.NameValue>> loadDynamicValues(final
val.setValue(String.class.cast(entry.get("id")));
return val;
})
.collect(toList());
.toList();
})
.orElse(emptyList()));
}
Expand Down Expand Up @@ -140,7 +140,7 @@ protected List<UiSchema.Parameter> toParams(final Collection<SimplePropertyDefin
.setPath(path.endsWith("[]") ? path.substring(0, path.length() - "[]".length()) : path);
return parameter;
})
.collect(toList());
.toList();

// if we are empty and there was no "empty" object then fail
if (!propertiesPrefix.startsWith("$") && resolvedParams.isEmpty()
Expand All @@ -149,7 +149,7 @@ protected List<UiSchema.Parameter> toParams(final Collection<SimplePropertyDefin
+ ref.getFamily() + "/" + ref.getType() + "/" + ref.getName());
}
return resolvedParams.stream();
}).collect(toList())).orElse(null);
}).toList()).orElse(null);
}

protected UiSchema newUiSchema(final PropertyContext<?> ctx) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected CompletionStage<PropertyContext<?>> fillProposalsAndReturn(final Prope
return pairs.thenApply(namedValues -> {
schema.setTitleMap(namedValues);
schema.setRestricted(true);
jsonSchema.setEnumValues(namedValues.stream().map(UiSchema.NameValue::getValue).collect(toList()));
jsonSchema.setEnumValues(namedValues.stream().map(UiSchema.NameValue::getValue).toList());
return context;
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public CompletionStage<PropertyContext<?>> convert(final CompletionStage<Propert
// if we have multiple tabs, priority is MAIN/ADVANCED pair first
// but if they are not present then we use all layouts in "String" order
final List<String> tabs = (layouts.containsKey("Main") ? Stream.of("Main", "Advanced")
: layouts.keySet().stream().sorted(String::compareToIgnoreCase)).collect(toList());
: layouts.keySet().stream().sorted(String::compareToIgnoreCase)).toList();

final UiSchema schema = newUiSchema(context);
schema.setTitle(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.talend.sdk.component.form.internal.converter.impl.widget;

import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;

import java.util.Collection;
import java.util.List;
Expand Down Expand Up @@ -69,7 +68,7 @@ public CompletionStage<PropertyContext<?>> convert(final CompletionStage<Propert
loadDynamicValues(client, family, actionName, context.getRootContext());
return pairs.thenApply(namedValues -> {
schema.setTitleMap(namedValues);
jsonSchema.setEnumValues(namedValues.stream().map(UiSchema.NameValue::getValue).collect(toList()));
jsonSchema.setEnumValues(namedValues.stream().map(UiSchema.NameValue::getValue).toList());
return context;
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.talend.sdk.component.form.internal.validation.spi.ext;

import static java.util.Comparator.comparing;
import static java.util.stream.Collectors.toList;

import java.util.Collection;
import java.util.Optional;
Expand Down Expand Up @@ -83,7 +82,7 @@ private Impl(final String pointer, final Function<JsonValue, JsonValue> extracto
.concat(Stream.of(types), Stream.of(JsonValue.ValueType.NULL))
.distinct()
.sorted(comparing(JsonValue.ValueType::name))
.collect(toList());
.toList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static java.util.Optional.ofNullable;
import static java.util.concurrent.CompletableFuture.completedFuture;
import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toSet;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
Expand All @@ -48,7 +47,6 @@
import java.util.concurrent.CompletionStage;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import javax.json.bind.Jsonb;
Expand Down Expand Up @@ -288,7 +286,7 @@
.getItems()
.stream()
.map(UiSchema::getTitle)
.collect(toList()));
.toList());
}

@Test
Expand Down Expand Up @@ -327,7 +325,7 @@
.map(UiSchema::getKey)
.filter(Objects::nonNull)
.map(s -> s.substring(s.lastIndexOf('.') + 1))
.collect(toList());
.toList();
assertEquals(asList("region", "unknownRegion", "bucket", "object", "encryptDataAtRest", "kmsForDataAtRest",
"format", "recordDelimiter", "specificRecordDelimiter", "fieldDelimiter", "specificFieldDelimiter",
"limit"), actualOrder);
Expand Down Expand Up @@ -462,7 +460,7 @@

assertEquals(5, tableDataSetMain.getItems().size());
assertEquals(asList("dataStore", "commonConfig", "Query", "Ordered", "Order"),
tableDataSetMain.getItems().stream().map(UiSchema::getTitle).collect(toList()));
tableDataSetMain.getItems().stream().map(UiSchema::getTitle).toList());

final Iterator<UiSchema> mainIt = tableDataSetMain.getItems().iterator();
final UiSchema dataStore = mainIt.next();
Expand All @@ -471,7 +469,7 @@
final UiSchema credentials = dataStoreIt.next();
assertEquals("columns", credentials.getWidget());
assertEquals(asList("Username", "Password"),
credentials.getItems().stream().map(UiSchema::getTitle).collect(toList()));
credentials.getItems().stream().map(UiSchema::getTitle).toList());

final UiSchema tableDataSetAdvanced = tableDataSetIt.next();
assertEquals("Advanced", tableDataSetAdvanced.getTitle());
Expand Down Expand Up @@ -539,7 +537,7 @@
assertEquals("SuggestionForJdbcDrivers", driverTrigger.getAction());
assertNull(driverTrigger.getRemote());
assertEquals(singletonList("currentValue/configuration.driver"),
driverTrigger.getParameters().stream().map(it -> it.getKey() + '/' + it.getPath()).collect(toList()));
driverTrigger.getParameters().stream().map(it -> it.getKey() + '/' + it.getPath()).toList());

assertEquals("change", triggers.next().getOnEvent());
}
Expand Down Expand Up @@ -625,7 +623,7 @@
}

@Test
void uiSchema() throws Exception {

Check warning on line 626 in component-form/component-form-core/src/test/java/org/talend/sdk/component/form/api/UiSpecServiceTest.java

View check run for this annotation

sonar-rnd / SonarQube Code Analysis

component-form/component-form-core/src/test/java/org/talend/sdk/component/form/api/UiSpecServiceTest.java#L626

Refactor this method to reduce the number of assertions from 32 to less than 25.
final Ui payload = service.convert(load("jdbc.json"), "en", null).toCompletableFuture().get();
final Collection<UiSchema> uiSchema = payload.getUiSchema();
assertNotNull(uiSchema);
Expand Down Expand Up @@ -658,7 +656,7 @@
.getTitleMap()
.stream()
.map(UiSchema.NameValue.class::cast)
.collect(Collectors.toList());
.toList();
assertEquals(1, titleMap.size());
final UiSchema.NameValue firstTitleMap = titleMap.iterator().next();
assertEquals("some.driver.Jdbc", firstTitleMap.getValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.talend.sdk.component.form.internal.validation;

import static java.util.stream.Collectors.toList;
import static org.junit.jupiter.api.Assertions.assertEquals;

import java.io.IOException;
Expand Down Expand Up @@ -61,7 +60,7 @@ public CompletionStage<Collection<ValidationError>> validate(final ConfigTypeNod
.getErrors()
.stream()
.map(e -> new ValidationError(e.getField(), e.getMessage()))
.collect(toList()));
.toList());
}

public CompletionStage<JsonSchemaValidator> getValidator(final ConfigTypeNode config) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap;
import static java.util.Collections.unmodifiableMap;
import static java.util.stream.Collectors.toList;

import java.util.ArrayList;
import java.util.Collection;
Expand Down Expand Up @@ -95,7 +94,7 @@ public UiSchema copy(final boolean frozenStructure) {
.withWidget(widget)
.withItemWidget(itemWidget)
.withType(type)
.withItems(items == null ? null : items.stream().map(it -> it.copy(frozenStructure)).collect(toList()))
.withItems(items == null ? null : items.stream().map(it -> it.copy(frozenStructure)).toList())
.withOptions(options)
.withAutoFocus(autoFocus)
.withDisabled(disabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static java.util.Comparator.comparing;
import static java.util.Comparator.comparingInt;
import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;

import java.lang.reflect.AnnotatedElement;
Expand Down Expand Up @@ -81,7 +80,7 @@ private Supplier<Ui> doCreateForm(final Class<?> clazz) {
return () -> Ui
.ui()
.withJsonSchema(ui.getJsonSchema())
.withUiSchema(ui.getUiSchema().stream().map(it -> it.copy(true)).collect(toList()))
.withUiSchema(ui.getUiSchema().stream().map(it -> it.copy(true)).toList())
.withProperties(emptyMap())
.build();
}
Expand Down Expand Up @@ -136,7 +135,7 @@ private UiSchema generateUiSchemas(final String keyPrefix, final AnnotatedElemen
final int pos = ofNullable(it.getAnnotation(View.Schema.class)).map(View.Schema::position).orElse(-1);
positions.put(it.getName(), pos < 0 ? Integer.MAX_VALUE : pos);
return generateUiSchemas(nextKey, it, it.getType(), isDynamic);
}).collect(toList()));
}).toList());
current = current.getSuperclass();
}
return applyConfig(element, builder, isDynamic)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.talend.sdk.component.runtime.beam.chain.impl;

import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;

import java.util.Collection;
Expand Down Expand Up @@ -209,7 +208,7 @@ private String toName(final String transform, final Job.Component component) {

private List<Job.Edge> getEdges(final List<Job.Edge> edges, final Job.Component step,
final Function<Job.Edge, Job.Component> componentMapper) {
return edges.stream().filter(edge -> componentMapper.apply(edge).equals(step)).collect(toList());
return edges.stream().filter(edge -> componentMapper.apply(edge).equals(step)).toList();
}

private PipelineOptions createPipelineOptions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.talend.sdk.component.runtime.beam.customizer;

import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -115,7 +114,7 @@ Stream<String> getClasses() {
.lines()
.map(String::trim)
.filter(it -> !it.startsWith("#") && !it.isEmpty())
.collect(toList())).stream();
.toList()).stream();
} catch (final IOException e) {
throw new IllegalStateException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package org.talend.sdk.component.runtime.beam.spi.record;

import static java.util.Optional.ofNullable;
import static java.util.stream.Collectors.toList;
import static org.talend.sdk.component.api.record.SchemaCompanionUtil.sanitizeName;
import static org.talend.sdk.component.runtime.beam.avro.AvroSchemas.unwrapUnion;

Expand All @@ -31,7 +30,6 @@
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import javax.json.bind.annotation.JsonbTransient;

Expand Down Expand Up @@ -110,7 +108,7 @@
}

if (value instanceof Collection) {
return Collection.class.cast(value).stream().map(v -> this.directMapping(v, entry)).collect(toList());
return Collection.class.cast(value).stream().map(v -> this.directMapping(v, entry)).toList();
}
if (value instanceof RecordImpl) {
return new AvroRecord((Record) value).delegate;
Expand Down Expand Up @@ -225,7 +223,7 @@
private <T> Collection<T> doMapCollection(final Class<T> type, final Collection<?> collection,
final org.apache.avro.Schema elementType) {
return ofNullable(collection)
.map(c -> c.stream().map(item -> doMap(type, elementType, item)).collect(toList()))
.map(c -> c.stream().map(item -> doMap(type, elementType, item)).toList())
.orElse(null);
}

Expand Down Expand Up @@ -297,12 +295,12 @@

if (value instanceof GenericArray && !GenericArray.class.isAssignableFrom(expectedType)) {
if (ZonedDateTime.class == expectedType) {
List<Long> longs = (List) Collection.class.cast(value).stream().collect(Collectors.toList());
List<Long> longs = (List) Collection.class.cast(value).stream().toList();

Check notice on line 298 in component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java

View check run for this annotation

sonar-rnd / SonarQube Code Analysis

component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java#L298

Remove this unnecessary cast to "List".
final Instant instant = Instant.ofEpochSecond(longs.get(0), longs.get(1));
return expectedType.cast(ZonedDateTime.ofInstant(instant, UTC));
}
if (Instant.class == expectedType) {
List<Long> longs = (List) Collection.class.cast(value).stream().collect(Collectors.toList());
List<Long> longs = (List) Collection.class.cast(value).stream().toList();

Check notice on line 303 in component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java

View check run for this annotation

sonar-rnd / SonarQube Code Analysis

component-runtime-beam/src/main/java/org/talend/sdk/component/runtime/beam/spi/record/AvroRecord.java#L303

Remove this unnecessary cast to "List".
final Instant instant = Instant.ofEpochSecond(longs.get(0), longs.get(1));
return expectedType.cast(instant);
}
Expand Down
Loading
Loading