diff --git a/server/src/main/java/io/spine/server/tuple/Element.java b/server/src/main/java/io/spine/server/tuple/Element.java index 8ae87efdc4..a4f61e20ae 100644 --- a/server/src/main/java/io/spine/server/tuple/Element.java +++ b/server/src/main/java/io/spine/server/tuple/Element.java @@ -87,7 +87,7 @@ final class Element implements Serializable { * Obtains the value of the element by its index and casts it to the type {@code }. */ @SuppressWarnings("TypeParameterUnusedInFormals") // See Javadoc. - static T value(Tuple tuple, IndexOf index) { + static T value(Tuple tuple, IndexOf index) { @SuppressWarnings("unchecked") // The caller is responsible for the correct type. var value = (T) tuple.get(index.value()); return value; diff --git a/server/src/main/java/io/spine/server/tuple/Pair.java b/server/src/main/java/io/spine/server/tuple/Pair.java index 5a9364769c..05de92c900 100644 --- a/server/src/main/java/io/spine/server/tuple/Pair.java +++ b/server/src/main/java/io/spine/server/tuple/Pair.java @@ -53,7 +53,7 @@ * the type of the second element */ public final class Pair - extends Tuple + extends Tuple implements AValue, BValue { private static final long serialVersionUID = 0L; diff --git a/server/src/main/java/io/spine/server/tuple/Quartet.java b/server/src/main/java/io/spine/server/tuple/Quartet.java index 78cafaf6e2..bcb297e455 100644 --- a/server/src/main/java/io/spine/server/tuple/Quartet.java +++ b/server/src/main/java/io/spine/server/tuple/Quartet.java @@ -58,7 +58,7 @@ * the type of the fourth element */ public final class Quartet - extends Tuple + extends Tuple implements AValue, BValue, CValue, DValue { private static final long serialVersionUID = 0L; diff --git a/server/src/main/java/io/spine/server/tuple/Quintet.java b/server/src/main/java/io/spine/server/tuple/Quintet.java index c2f658d029..abbfa428ce 100644 --- a/server/src/main/java/io/spine/server/tuple/Quintet.java +++ b/server/src/main/java/io/spine/server/tuple/Quintet.java @@ -61,8 +61,8 @@ * the type of the fifth element */ public final class Quintet - extends Tuple - implements AValue, BValue, CValue, DValue, EValue { + extends Tuple + implements AValue, BValue, CValue, DValue, EValue { private static final long serialVersionUID = 0L; diff --git a/server/src/main/java/io/spine/server/tuple/Triplet.java b/server/src/main/java/io/spine/server/tuple/Triplet.java index 967a80b050..804b865a60 100644 --- a/server/src/main/java/io/spine/server/tuple/Triplet.java +++ b/server/src/main/java/io/spine/server/tuple/Triplet.java @@ -55,7 +55,7 @@ * the type of the third element */ public final class Triplet - extends Tuple + extends Tuple implements AValue, BValue, CValue { private static final long serialVersionUID = 0L; diff --git a/server/src/main/java/io/spine/server/tuple/Tuple.java b/server/src/main/java/io/spine/server/tuple/Tuple.java index b7734ee8e9..531df0609b 100644 --- a/server/src/main/java/io/spine/server/tuple/Tuple.java +++ b/server/src/main/java/io/spine/server/tuple/Tuple.java @@ -46,11 +46,8 @@ /** * Abstract base for tuple classes. - * - * @param - * the type of the tuple first element */ -public abstract class Tuple implements Iterable, Serializable { +public abstract class Tuple implements Iterable, Serializable { private static final long serialVersionUID = 0L; @@ -86,7 +83,7 @@ protected Tuple(Object... values) { * @throws IllegalArgumentException if the passed value is {@link Empty} */ @CanIgnoreReturnValue - static > + static @Nullable M checkNotEmpty(Class checkingClass, @Nullable M value) { if (value == null) { return null; @@ -103,7 +100,7 @@ protected Tuple(Object... values) { @CanIgnoreReturnValue @SuppressWarnings("ConstantConditions") /* `checkNotNull` is used by design. */ - static > + static M checkNotNullOrEmpty(Class checkingClass, M value) { var result = checkNotEmpty(checkingClass, value); checkNotNull(result); @@ -111,7 +108,7 @@ M checkNotNullOrEmpty(Class checkingClass, M value) { } @SafeVarargs - static > + static void checkAllNotNullOrEmpty(Class checkingClass, M... values) { for (var value : values) { checkNotNullOrEmpty(checkingClass, value); @@ -119,7 +116,7 @@ void checkAllNotNullOrEmpty(Class checkingClass, M... values) { } @SafeVarargs - static > + static void checkAllNotEmpty(Class checkingClass, M... values) { for (var value : values) { checkNotEmpty(checkingClass, value); @@ -127,8 +124,8 @@ void checkAllNotEmpty(Class checkingClass, M... values) { } @Override - public final @NonNull Iterator iterator() { - Iterator result = new ExtractingIterator<>(values); + public final @NonNull Iterator iterator() { + Iterator result = new ExtractingIterator(values); return result; } @@ -158,7 +155,7 @@ public final boolean equals(Object obj) { if (!(obj instanceof Tuple)) { return false; } - var other = (Tuple) obj; + var other = (Tuple) obj; return Objects.equals(this.values, other.values); } @@ -178,12 +175,8 @@ static boolean isOptionalPresent(Object value) { /** * Traverses through elements obtaining a message value from them. - * - * @param - * the type of the messages extracted by the iterator */ - private static final class ExtractingIterator - extends UnmodifiableIterator { + private static final class ExtractingIterator extends UnmodifiableIterator { private final Iterator source; @@ -198,10 +191,9 @@ public boolean hasNext() { } @Override - public M next() { + public Message next() { var next = source.next(); - @SuppressWarnings("unchecked") - var result = (M) next.toMessage(); + var result = next.toMessage(); return result; } } diff --git a/server/src/main/kotlin/io/spine/server/event/Just.kt b/server/src/main/kotlin/io/spine/server/event/Just.kt index f25d652bc7..5a256804b2 100644 --- a/server/src/main/kotlin/io/spine/server/event/Just.kt +++ b/server/src/main/kotlin/io/spine/server/event/Just.kt @@ -38,7 +38,7 @@ import io.spine.server.tuple.Tuple * * @param E the type of the event. */ -public class Just(event: E) : Tuple(event) { +public class Just(event: E) : Tuple(event) { public companion object {