From 99e5b63d04433f112055567eaa80590a9c9016f7 Mon Sep 17 00:00:00 2001 From: Silvio Giebl Date: Tue, 14 Nov 2023 17:10:52 +0100 Subject: [PATCH] Fix nullability annotations on wildcard types --- .../mqtt/mqtt3/message/subscribe/Mqtt3Subscribe.java | 2 +- .../message/subscribe/Mqtt3SubscribeBuilderBase.java | 4 ++-- .../mqtt/mqtt3/message/unsubscribe/Mqtt3Unsubscribe.java | 2 +- .../client2/mqtt/mqtt5/datatypes/Mqtt5UserProperties.java | 2 +- .../mqtt5/datatypes/Mqtt5UserPropertiesBuilderBase.java | 4 ++-- .../mqtt/mqtt5/message/subscribe/Mqtt5Subscribe.java | 2 +- .../message/subscribe/Mqtt5SubscribeBuilderBase.java | 8 ++++---- .../mqtt/mqtt5/message/unsubscribe/Mqtt5Unsubscribe.java | 2 +- .../message/unsubscribe/Mqtt5UnsubscribeBuilderBase.java | 4 ++-- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3Subscribe.java b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3Subscribe.java index 6ad1580c3..ed6d302d4 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3Subscribe.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3Subscribe.java @@ -47,7 +47,7 @@ public interface Mqtt3Subscribe extends Mqtt3Message { * @return the {@link Mqtt3Subscription Subscriptions} of this Subscribe message. The list contains at least one * Subscription. */ - @Unmodifiable @NotNull List<@NotNull ? extends Mqtt3Subscription> getSubscriptions(); + @Unmodifiable @NotNull List getSubscriptions(); @Override default @NotNull Mqtt3MessageType getType() { diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3SubscribeBuilderBase.java b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3SubscribeBuilderBase.java index 827389765..6ff4b1ed0 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3SubscribeBuilderBase.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/subscribe/Mqtt3SubscribeBuilderBase.java @@ -76,7 +76,7 @@ public interface Mqtt3SubscribeBuilderBase subscriptions); + @NotNull C addSubscriptions(@NotNull Collection subscriptions); /** * Adds a stream of {@link Mqtt3Subscription}s to the {@link Mqtt3Subscribe#getSubscriptions() list of @@ -87,7 +87,7 @@ public interface Mqtt3SubscribeBuilderBase subscriptions); + @NotNull C addSubscriptions(@NotNull Stream subscriptions); /** * {@link Mqtt3SubscribeBuilderBase} that is complete which means all mandatory fields are set. diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/unsubscribe/Mqtt3Unsubscribe.java b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/unsubscribe/Mqtt3Unsubscribe.java index 34a63413b..d3f3a1a0c 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/unsubscribe/Mqtt3Unsubscribe.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt3/message/unsubscribe/Mqtt3Unsubscribe.java @@ -48,7 +48,7 @@ public interface Mqtt3Unsubscribe extends Mqtt3Message { /** * @return the Topic Filters of this Unsubscribe message. The list contains at least one Topic Filter. */ - @Unmodifiable @NotNull List<@NotNull ? extends MqttTopicFilter> getTopicFilters(); + @Unmodifiable @NotNull List getTopicFilters(); @Override default @NotNull Mqtt3MessageType getType() { diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserProperties.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserProperties.java index 1c7a8a9b8..401f8c321 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserProperties.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserProperties.java @@ -74,7 +74,7 @@ public interface Mqtt5UserProperties { /** * @return the User Properties as an immutable list. */ - @Unmodifiable @NotNull List<@NotNull ? extends Mqtt5UserProperty> asList(); + @Unmodifiable @NotNull List asList(); /** * @return a builder for extending this collection of User Properties. diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserPropertiesBuilderBase.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserPropertiesBuilderBase.java index 7ae9479ae..ec4f64d1e 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserPropertiesBuilderBase.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/datatypes/Mqtt5UserPropertiesBuilderBase.java @@ -81,7 +81,7 @@ public interface Mqtt5UserPropertiesBuilderBase userProperties); + @NotNull B addAll(@NotNull Collection userProperties); /** * Adds a stream of {@link Mqtt5UserProperty User Properties}. @@ -91,5 +91,5 @@ public interface Mqtt5UserPropertiesBuilderBase userProperties); + @NotNull B addAll(@NotNull Stream userProperties); } diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5Subscribe.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5Subscribe.java index c5873a0f2..8e0e16f6a 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5Subscribe.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5Subscribe.java @@ -48,7 +48,7 @@ public interface Mqtt5Subscribe extends Mqtt5Message { * @return the {@link Mqtt5Subscription Subscriptions} of this Subscribe message. The list contains at least one * Subscription. */ - @Unmodifiable @NotNull List<@NotNull ? extends Mqtt5Subscription> getSubscriptions(); + @Unmodifiable @NotNull List getSubscriptions(); /** * @return the optional user properties of this Subscribe message. diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5SubscribeBuilderBase.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5SubscribeBuilderBase.java index 36ece9dbc..7824ebe91 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5SubscribeBuilderBase.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/subscribe/Mqtt5SubscribeBuilderBase.java @@ -78,18 +78,18 @@ public interface Mqtt5SubscribeBuilderBase subscriptions); + @NotNull C addSubscriptions(@NotNull Collection subscriptions); /** - * Adds a stream of {@link Mqtt5Subscription}s to the {@link Mqtt5Subscribe#getSubscriptions() list of - * subscriptions}. At least one subscription is mandatory. + * Adds a stream of {@link Mqtt5Subscription}s to the + * {@link Mqtt5Subscribe#getSubscriptions() list of subscriptions}. At least one subscription is mandatory. * * @param subscriptions the stream of subscriptions. * @return the builder that is now complete as at least one subscription is set. * @since 1.2 */ @CheckReturnValue - @NotNull C addSubscriptions(@NotNull Stream<@NotNull ? extends Mqtt5Subscription> subscriptions); + @NotNull C addSubscriptions(@NotNull Stream subscriptions); /** * {@link Mqtt5SubscribeBuilderBase} that is complete which means all mandatory fields are set. diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5Unsubscribe.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5Unsubscribe.java index 81f40e2f2..43fc189ad 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5Unsubscribe.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5Unsubscribe.java @@ -48,7 +48,7 @@ public interface Mqtt5Unsubscribe extends Mqtt5Message { /** * @return the Topic Filters of this Unsubscribe message. The list contains at least one Topic Filter. */ - @Unmodifiable @NotNull List<@NotNull ? extends MqttTopicFilter> getTopicFilters(); + @Unmodifiable @NotNull List getTopicFilters(); /** * @return the optional user properties of this Unsubscribe message. diff --git a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5UnsubscribeBuilderBase.java b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5UnsubscribeBuilderBase.java index 1888d5261..b4cbe08d5 100644 --- a/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5UnsubscribeBuilderBase.java +++ b/src/main/java/com/hivemq/client2/mqtt/mqtt5/message/unsubscribe/Mqtt5UnsubscribeBuilderBase.java @@ -91,7 +91,7 @@ public interface Mqtt5UnsubscribeBuilderBase topicFilters); + @NotNull C addTopicFilters(@NotNull Collection topicFilters); /** * Adds a stream of {@link MqttTopicFilter Topic Filters} to the {@link Mqtt5Unsubscribe#getTopicFilters() list of @@ -102,7 +102,7 @@ public interface Mqtt5UnsubscribeBuilderBase topicFilters); + @NotNull C addTopicFilters(@NotNull Stream topicFilters); /** * Reverses the subscriptions of a Subscribe message by adding their Topic Filters.