-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up all warnings in Java client test #1213
Clean up all warnings in Java client test #1213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are few more unchecked casts in RedisClusterClientTest
and in FfiTest
Try adding
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}
to build.gradle
and rerun ./gradlew compileTest
Please add |
It's just |
I hanged once UTs by using incorrect mockito's mock. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 2 UTs which still mocking a future:
type_returns_success
time_returns_success
* Clean up all warnings in Java client test Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
e32ea19
to
960ef67
Compare
Signed-off-by: Andrew Carbonetto <[email protected]>
Please send a ping once CI is passing |
Signed-off-by: Yury-Fridlyand <[email protected]>
@@ -30,17 +28,19 @@ public void init() { | |||
public void getOrCreate_returns_default_after_repeated_calls() { | |||
ThreadPoolResource mockedThreadPoolResource = mock(ThreadPoolResource.class); | |||
EventLoopGroup mockedEventLoopGroup = mock(EventLoop.class); | |||
@SuppressWarnings("unchecked") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? what's the warning? can't it be fixed other way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Supplier
is a paramtrized type (it has <>
), but mock returns a raw type of Supplier
and can't return Supplier<something>
.
Assigning Supplier
to a Supplier<...>
does not require a cast, but it produces a compiler warning, which we acknoledge and suppress.
If we keep using raw Supplier
we have another warning about using raw types, which should be also suppressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use an actual supplier instead of mocks. We would lose the verify check, but that's not really important.
@@ -88,6 +88,7 @@ private static Stream<Arguments> clientAndDataSize() { | |||
@MethodSource("clientAndDataSize") | |||
public void client_can_handle_concurrent_workload(BaseClient client, int valueSize) { | |||
ExecutorService executorService = Executors.newCachedThreadPool(); | |||
@SuppressWarnings("rawtypes") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same qustion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated code here and change suppression to be the same as above.
Meanwhile, a good read https://stackoverflow.com/a/9542131/21176342
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please explain the SuppressWarnings, other than that looks ok.
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Andrew Carbonetto <[email protected]>
commit 0a430cf Author: Andrew Carbonetto <[email protected]> Date: Wed Apr 10 13:30:02 2024 -0700 Java/Node: Update docs for `xadd` and `xtrim` (valkey-io#1246) * Java: Add XADD command (Stream commands) (valkey-io#155) * Add Stream XADD command to Java Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> * Java: Add Zpopmax command. (Sorted Set Commands) (valkey-io#1164) * Java: Add Zpopmax command. (Sorted Set Commands) (valkey-io#149) * Minor documentation update. * Minor test update. * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> * Minor documentation update. * Rebase + Spotless --------- Signed-off-by: Andrew Carbonetto <[email protected]> Co-authored-by: Andrew Carbonetto <[email protected]> * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> * Clean up merge Signed-off-by: Andrew Carbonetto <[email protected]> * Move xadd command Signed-off-by: Andrew Carbonetto <[email protected]> * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> * PR comments. Signed-off-by: Yury-Fridlyand <[email protected]> * Update xtrim documentation Signed-off-by: Andrew Carbonetto <[email protected]> * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> Signed-off-by: Yury-Fridlyand <[email protected]> Co-authored-by: SanHalacogluImproving <[email protected]> Co-authored-by: Yury-Fridlyand <[email protected]> commit 4ce976c Author: SanHalacogluImproving <[email protected]> Date: Wed Apr 10 12:36:56 2024 -0700 Java: Add `Zmscore` command. (Sorted Set Command Group) (valkey-io#1234) * Java: Add Zmscore command. (Sorted Set Command Group) (valkey-io#173) * Minor update + remove change log. * Minor documentation update. * Minor IT update. * Rebase + Spotless. * Minor IT test update. commit ae0a8f4 Author: Yury-Fridlyand <[email protected]> Date: Wed Apr 10 12:33:22 2024 -0700 Java: Refactor transaction UT (valkey-io#1242) Refactor transaction UT. (valkey-io#192) Signed-off-by: Yury-Fridlyand <[email protected]> commit fec74b8 Author: Andrew Carbonetto <[email protected]> Date: Wed Apr 10 12:28:18 2024 -0700 Clean up all warnings in Java client test (valkey-io#1213) * Clean up all warnings in Java client test Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> * Clean FfiTest.java of warnings Signed-off-by: Andrew Carbonetto <[email protected]> * Clean RedisClusterClientTest.java of compiler warnings Signed-off-by: Andrew Carbonetto <[email protected]> * Clean up more warnings in client tests Signed-off-by: Andrew Carbonetto <[email protected]> * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> * Fix UT + update IT. Signed-off-by: Yury-Fridlyand <[email protected]> * Update suppression. Signed-off-by: Yury-Fridlyand <[email protected]> * Remove suppress warnings 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]> commit 527e1ec Author: SanHalacogluImproving <[email protected]> Date: Wed Apr 10 12:06:01 2024 -0700 Java: Add `lindex` command. (List Command Group) (valkey-io#1219) * Java: Add lindex command. (List Command Group) (valkey-io#158) * Minor documentation update + changed param from int to long + minor IT update. commit d766f51 Author: Andrew Carbonetto <[email protected]> Date: Wed Apr 10 10:01:55 2024 -0700 Node: Fix build section for node DEVELOPER.md (valkey-io#1250) * Fix build section for node DEVELOPER.md Signed-off-by: Andrew Carbonetto <[email protected]> * Fix numbers in DEVELOPER.md Signed-off-by: Andrew Carbonetto <[email protected]> * Run prettier --------- Signed-off-by: Andrew Carbonetto <[email protected]> Co-authored-by: Jonathan Louie <[email protected]> commit 939a519 Author: jonathanl-bq <[email protected]> Date: Wed Apr 10 09:08:43 2024 -0700 Java: Use LinkedHashMap instead of HashMap for Java wrapper Map values returned from Redis (valkey-io#1257) * Use LinkedHashMap instead of HashMap for Java wrapper Map values returned from Redis * Run cargo fmt commit d21dbc9 Author: Shoham Elias <[email protected]> Date: Wed Apr 10 18:02:22 2024 +0300 add missing examples and minor doc fix (valkey-io#1258) commit 09bec2d Author: ort-bot <[email protected]> Date: Wed Apr 10 00:19:09 2024 +0000 Updated attribution files commit 4e7acdc Author: Adan Wattad <[email protected]> Date: Wed Apr 10 11:11:21 2024 +0300 Node: added zrange and zrangeWithScores commands. (valkey-io#1115) --------- Co-authored-by: Adan <[email protected]> Co-authored-by: Shoham Elias <[email protected]> Co-authored-by: Shoham Elias <[email protected]> commit 79c49a4 Author: Gilboab <[email protected]> Date: Wed Apr 10 10:53:16 2024 +0300 Python: Added RENAME command (valkey-io#1252) Python: Added rename command commit 78cfa33 Author: Adan Wattad <[email protected]> Date: Tue Apr 9 14:29:45 2024 +0300 Node: added spop and spopCount commands. (valkey-io#1117) Co-authored-by: Shoham Elias <[email protected]> commit 5395fe1 Author: Shoham Elias <[email protected]> Date: Tue Apr 9 12:23:59 2024 +0300 Python: adds ZREMRANGEBYSCORE command (valkey-io#1151)
* Clean up all warnings in Java client test Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> * Clean FfiTest.java of warnings Signed-off-by: Andrew Carbonetto <[email protected]> * Clean RedisClusterClientTest.java of compiler warnings Signed-off-by: Andrew Carbonetto <[email protected]> * Clean up more warnings in client tests Signed-off-by: Andrew Carbonetto <[email protected]> * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> * Fix UT + update IT. Signed-off-by: Yury-Fridlyand <[email protected]> * Update suppression. Signed-off-by: Yury-Fridlyand <[email protected]> * Remove suppress warnings 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]>
* Clean up all warnings in Java client test Signed-off-by: Andrew Carbonetto <[email protected]> --------- Signed-off-by: Andrew Carbonetto <[email protected]> * Clean FfiTest.java of warnings Signed-off-by: Andrew Carbonetto <[email protected]> * Clean RedisClusterClientTest.java of compiler warnings Signed-off-by: Andrew Carbonetto <[email protected]> * Clean up more warnings in client tests Signed-off-by: Andrew Carbonetto <[email protected]> * Spotless Signed-off-by: Andrew Carbonetto <[email protected]> * Fix UT + update IT. Signed-off-by: Yury-Fridlyand <[email protected]> * Update suppression. Signed-off-by: Yury-Fridlyand <[email protected]> * Remove suppress warnings 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]>
Issue #, if available:
Description of changes:
Cleans up all compiler warnings in the Java/Client/src/test folder. Most of the changes are like this:
changed to:
The above tests clean up the type error when converting from
CompletableFuture
toCompletableFuture<Object>
.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.