You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "rpuch (via GitHub)" <gi...@apache.org> on 2024/04/05 12:53:02 UTC
[PR] IGNITE-21995 Do not disable thread assertions in tests [ignite-3]
rpuch opened a new pull request, #3565:
URL: https://github.com/apache/ignite-3/pull/3565
https://issues.apache.org/jira/browse/IGNITE-21995
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21995 Do not disable thread assertions in tests [ignite-3]
Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #3565:
URL: https://github.com/apache/ignite-3/pull/3565#discussion_r1557435036
##########
modules/core/src/main/java/org/apache/ignite/internal/wrapper/Wrappers.java:
##########
@@ -34,4 +36,19 @@ public static <T> T unwrap(Object object, Class<T> classToUnwrap) {
return classToUnwrap.cast(object);
}
+
+ /**
+ * Unwraps an object or returns {@code null} if it's {@code null}.
+ *
+ * @param object Object to unwrap.
+ * @param classToUnwrap Class which is to be unwrapped.
+ * @see #unwrap(Object, Class)
+ */
+ public static @Nullable <T> T unwrapNullable(@Nullable Object object, Class<T> classToUnwrap) {
Review Comment:
The reason I added another method is nullability. If we have just one method, it must allow a nullable argument and the return value must be nullable. But there are many cases where we are sure that the argument (that we want to unwrap) is not nullable, and we want the result to be non-nullable too. It seems that we cannot achieve this with just one method, hence having 2 seems to be handy.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21995 Do not disable thread assertions in tests [ignite-3]
Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #3565:
URL: https://github.com/apache/ignite-3/pull/3565#discussion_r1557429262
##########
modules/core/src/main/java/org/apache/ignite/internal/wrapper/Wrappers.java:
##########
@@ -34,4 +36,19 @@ public static <T> T unwrap(Object object, Class<T> classToUnwrap) {
return classToUnwrap.cast(object);
}
+
+ /**
+ * Unwraps an object or returns {@code null} if it's {@code null}.
+ *
+ * @param object Object to unwrap.
+ * @param classToUnwrap Class which is to be unwrapped.
+ * @see #unwrap(Object, Class)
+ */
+ public static @Nullable <T> T unwrapNullable(@Nullable Object object, Class<T> classToUnwrap) {
Review Comment:
I saw that method `java.lang.Class#cast` will return `null` if `null` is passed to it, I think we can change the signature of `org.apache.ignite.internal.wrapper.Wrappers#unwrap` or add a check to it.
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] IGNITE-21995 Do not disable thread assertions in tests [ignite-3]
Posted by "ibessonov (via GitHub)" <gi...@apache.org>.
ibessonov merged PR #3565:
URL: https://github.com/apache/ignite-3/pull/3565
--
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: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org