From e28745a11e1d05e790a1d0c34431d14d2e52adfa Mon Sep 17 00:00:00 2001 From: Gabriel Erzse Date: Fri, 15 Mar 2024 09:34:13 +0200 Subject: [PATCH 1/2] Fix typo in SetPipelineCommands method name One method in the SetPipelineCommands interface does not respect the general naming pattern. Add a new method that respects naming, and deprecate the other one. --- src/main/java/redis/clients/jedis/PipeliningBase.java | 2 +- .../clients/jedis/commands/SetPipelineCommands.java | 9 ++++++++- .../java/redis/clients/jedis/ClusterPipeliningTest.java | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/redis/clients/jedis/PipeliningBase.java b/src/main/java/redis/clients/jedis/PipeliningBase.java index e9b6d49b73..62b773cdab 100644 --- a/src/main/java/redis/clients/jedis/PipeliningBase.java +++ b/src/main/java/redis/clients/jedis/PipeliningBase.java @@ -786,7 +786,7 @@ public Response> sdiff(String... keys) { } @Override - public Response sdiffStore(String dstKey, String... keys) { + public Response sdiffstore(String dstKey, String... keys) { return appendCommand(commandObjects.sdiffstore(dstKey, keys)); } diff --git a/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java index 4d915e31e7..919ba7961f 100644 --- a/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java @@ -37,7 +37,14 @@ default Response> sscan(String key, String cursor) { Response> sdiff(String... keys); - Response sdiffStore(String dstKey, String... keys); + Response sdiffstore(String dstKey, String... keys); + + /** + * @deprecated Use {@code redis.clients.jedis.commands.SetPipelineCommands#sdiffstore(java.lang.String, java.lang.String...)} + */ + default Response sdiffStore(String dstKey, String... keys) { + return sdiffstore(dstKey, keys); + } Response> sinter(String... keys); diff --git a/src/test/java/redis/clients/jedis/ClusterPipeliningTest.java b/src/test/java/redis/clients/jedis/ClusterPipeliningTest.java index 3ed45bae63..ff196ec4ea 100644 --- a/src/test/java/redis/clients/jedis/ClusterPipeliningTest.java +++ b/src/test/java/redis/clients/jedis/ClusterPipeliningTest.java @@ -527,7 +527,8 @@ public void clusterPipelineSet() { Response r1 = p.sadd("my{set}", "hello", "hello", "world", "foo", "bar"); p.sadd("mynew{set}", "hello", "hello", "world"); Response> r2 = p.sdiff("my{set}", "mynew{set}"); - Response r3 = p.sdiffStore("diffset{set}", "my{set}", "mynew{set}"); + Response r3deprecated = p.sdiffStore("diffset{set}deprecated", "my{set}", "mynew{set}"); + Response r3 = p.sdiffstore("diffset{set}", "my{set}", "mynew{set}"); Response> r4 = p.smembers("diffset{set}"); Response> r5 = p.sinter("my{set}", "mynew{set}"); Response r6 = p.sinterstore("interset{set}", "my{set}", "mynew{set}"); @@ -547,6 +548,7 @@ public void clusterPipelineSet() { p.sync(); assertEquals(Long.valueOf(4), r1.get()); assertEquals(diff, r2.get()); + assertEquals(Long.valueOf(diff.size()), r3deprecated.get()); assertEquals(Long.valueOf(diff.size()), r3.get()); assertEquals(diff, r4.get()); assertEquals(inter, r5.get()); From ccf1367aa23d344f9da842605242fc6be529d054 Mon Sep 17 00:00:00 2001 From: Gabriel Erzse Date: Fri, 15 Mar 2024 18:28:12 +0200 Subject: [PATCH 2/2] Refine javadoc for the deprecated method Co-authored-by: M Sazzadul Hoque <7600764+sazzad16@users.noreply.github.com> --- .../java/redis/clients/jedis/commands/SetPipelineCommands.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java b/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java index 919ba7961f..948c04ad69 100644 --- a/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java +++ b/src/main/java/redis/clients/jedis/commands/SetPipelineCommands.java @@ -40,8 +40,9 @@ default Response> sscan(String key, String cursor) { Response sdiffstore(String dstKey, String... keys); /** - * @deprecated Use {@code redis.clients.jedis.commands.SetPipelineCommands#sdiffstore(java.lang.String, java.lang.String...)} + * @deprecated Use {@link SetPipelineCommands#sdiffstore(java.lang.String, java.lang.String...)}. */ + @Deprecated default Response sdiffStore(String dstKey, String... keys) { return sdiffstore(dstKey, keys); }