From 5d609944f21b3b2c65d482654f55f0543c3977cf Mon Sep 17 00:00:00 2001 From: Philipp Schirmer Date: Tue, 30 Jan 2024 14:31:28 +0100 Subject: [PATCH] Build in CI using JDK 17 (#15) --- azure-pipelines.yml | 2 ++ src/main/java/com/bakdata/util/seq2/BaseSeq.java | 16 ++++++++++++++-- src/main/java/com/bakdata/util/seq2/PairSeq.java | 11 +++-------- src/main/java/com/bakdata/util/seq2/Seq2.java | 14 ++------------ 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index f6b92af..48cd11a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -19,6 +19,8 @@ resources: jobs: - template: azure/gradle/build.yml@templates + parameters: + jdkVersion: '1.17' - template: azure/gradle/create_tag_version.yml@templates - template: azure/gradle/upload_release.yml@templates - template: azure/gradle/upload_snapshot.yml@templates diff --git a/src/main/java/com/bakdata/util/seq2/BaseSeq.java b/src/main/java/com/bakdata/util/seq2/BaseSeq.java index b475441..a017c16 100644 --- a/src/main/java/com/bakdata/util/seq2/BaseSeq.java +++ b/src/main/java/com/bakdata/util/seq2/BaseSeq.java @@ -1,5 +1,5 @@ /* - * Copyright (c), 2023 bakdata GmbH + * Copyright (c), 2024 bakdata GmbH * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -22,7 +22,9 @@ import java.util.Optional; import java.util.OptionalLong; import java.util.Set; +import java.util.Spliterator; import java.util.function.BiFunction; +import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; import java.util.function.Supplier; @@ -34,7 +36,7 @@ import org.jooq.lambda.Seq; import org.jooq.lambda.exception.TooManyElementsException; -public interface BaseSeq { +public interface BaseSeq extends Iterable, Stream { /** * @see Seq#avg() */ @@ -295,6 +297,11 @@ default U foldRight(final U seed, final BiFunction action) { + this.toSeq().forEach(action); + } + /** * @see Seq#format() */ @@ -535,6 +542,11 @@ default void printOut() { this.toSeq().printOut(); } + @Override + default Spliterator spliterator() { + return this.toSeq().spliterator(); + } + /** * @see Seq#sum() */ diff --git a/src/main/java/com/bakdata/util/seq2/PairSeq.java b/src/main/java/com/bakdata/util/seq2/PairSeq.java index 55c1f66..2ffe75e 100644 --- a/src/main/java/com/bakdata/util/seq2/PairSeq.java +++ b/src/main/java/com/bakdata/util/seq2/PairSeq.java @@ -1,5 +1,5 @@ /* - * Copyright (c), 2023 bakdata GmbH + * Copyright (c), 2024 bakdata GmbH * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -47,7 +47,7 @@ import org.jooq.lambda.tuple.Tuple2; @SuppressWarnings("deprecation") -public interface PairSeq extends Stream>, Iterable>, BaseSeq> { +public interface PairSeq extends BaseSeq> { /** * @see Seq#empty() */ @@ -1044,7 +1044,7 @@ default Seq2 flatMapToOptional( @Override @Deprecated default void forEach(final Consumer> action) { - this.toSeq2().forEach(action); + BaseSeq.super.forEach(action); } /** @@ -2494,11 +2494,6 @@ default Tuple2>, PairSeq> splitAtHead() { return this.toSeq2().splitAtHead().map2(PairSeq::seq); } - @Override - default Spliterator> spliterator() { - return this.toSeq2().spliterator(); - } - /** * @deprecated Use {@link #sum(BiFunction)} */ diff --git a/src/main/java/com/bakdata/util/seq2/Seq2.java b/src/main/java/com/bakdata/util/seq2/Seq2.java index 239ef81..090a0ef 100644 --- a/src/main/java/com/bakdata/util/seq2/Seq2.java +++ b/src/main/java/com/bakdata/util/seq2/Seq2.java @@ -1,5 +1,5 @@ /* - * Copyright (c), 2023 bakdata GmbH + * Copyright (c), 2024 bakdata GmbH * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -42,7 +42,7 @@ import org.jooq.lambda.tuple.Tuple2; @SuppressWarnings("deprecation") -public interface Seq2 extends Stream, Iterable, BaseSeq { +public interface Seq2 extends BaseSeq { /** * @see Seq#empty() */ @@ -487,11 +487,6 @@ default PairSeq flatMapToIterablePair( return this.flatMapToPair(t -> seq(mapper.apply(t))); } - @Override - default void forEach(final Consumer action) { - this.toSeq().forEach(action); - } - @Override default void forEachOrdered(final Consumer action) { this.toSeq().forEachOrdered(action); @@ -1174,11 +1169,6 @@ default Tuple2, Seq2> splitAtHead() { return this.toSeq().splitAtHead().map2(Seq2::seq); } - @Override - default Spliterator spliterator() { - return this.toSeq().spliterator(); - } - /** * @see Seq#take(long) */