sashapolo commented on code in PR #1016:
URL: https://github.com/apache/ignite-3/pull/1016#discussion_r955906440
##########
modules/core/src/main/java/org/apache/ignite/internal/util/ByteUtils.java:
##########
@@ -123,12 +123,12 @@ public static byte[] toBytes(Object obj) {
* @param bytes Byte array.
* @return Object.
*/
- public static Object fromBytes(byte[] bytes) {
+ public static <T> T fromBytes(byte[] bytes) {
try (
var bis = new ByteArrayInputStream(bytes);
var in = new ObjectInputStream(bis)
) {
- return in.readObject();
+ return (T) in.readObject();
Review Comment:
This is an unsafe cast, I would prefer to leave the current approach with
explicit casting
##########
modules/network/src/main/java/org/apache/ignite/internal/network/netty/NettyUtils.java:
##########
@@ -38,18 +41,21 @@ public class NettyUtils {
* @return CompletableFuture.
*/
public static <T, R, F extends Future<R>> CompletableFuture<T>
toCompletableFuture(
- F nettyFuture,
+ @Schedule F nettyFuture,
Function<F, T> mapper
) {
var fut = new CompletableFuture<T>();
- nettyFuture.addListener((F future) -> {
- if (future.isSuccess()) {
- fut.complete(mapper.apply(future));
- } else if (future.isCancelled()) {
- fut.cancel(true);
- } else {
- fut.completeExceptionally(future.cause());
+ nettyFuture.addListener(new GenericFutureListener<F>() {
+ @Override
+ public void operationComplete(@Execute F future) throws Exception {
Review Comment:
Is it impossible to add annotations to lambda parameters?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]