Skip to content

Commit

Permalink
Java: Add @nonnull annotation to constructors and generic functions (v…
Browse files Browse the repository at this point in the history
…alkey-io#928)

* Add @nonnull annotation to constructors and generic functions

Signed-off-by: Andrew Carbonetto <[email protected]>

---------

Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Co-authored-by: Yury-Fridlyand <[email protected]>
  • Loading branch information
acarbonetto and Yury-Fridlyand authored Feb 15, 2024
1 parent b17a77f commit 2c55611
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion java/client/src/main/java/glide/api/RedisClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ protected RedisClient(ConnectionManager connectionManager, CommandManager comman
* @param config Redis client Configuration
* @return A Future to connect and return a RedisClient
*/
public static CompletableFuture<RedisClient> CreateClient(RedisClientConfiguration config) {
public static CompletableFuture<RedisClient> CreateClient(
@NonNull RedisClientConfiguration config) {
return CreateClient(config, RedisClient::new);
}

Expand Down
7 changes: 4 additions & 3 deletions java/client/src/main/java/glide/api/RedisClusterClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,21 @@ protected RedisClusterClient(ConnectionManager connectionManager, CommandManager
* @return A Future to connect and return a RedisClusterClient
*/
public static CompletableFuture<RedisClusterClient> CreateClient(
RedisClusterClientConfiguration config) {
@NonNull RedisClusterClientConfiguration config) {
return CreateClient(config, RedisClusterClient::new);
}

@Override
public CompletableFuture<ClusterValue<Object>> customCommand(String[] args) {
public CompletableFuture<ClusterValue<Object>> customCommand(@NonNull String[] args) {
// TODO if a command returns a map as a single value, ClusterValue misleads user
return commandManager.submitNewCommand(
CustomCommand, args, response -> ClusterValue.of(handleObjectOrNullResponse(response)));
}

@Override
@SuppressWarnings("unchecked")
public CompletableFuture<ClusterValue<Object>> customCommand(String[] args, Route route) {
public CompletableFuture<ClusterValue<Object>> customCommand(
@NonNull String[] args, @NonNull Route route) {
return commandManager.submitNewCommand(
CustomCommand,
args,
Expand Down

0 comments on commit 2c55611

Please sign in to comment.