rpuch commented on a change in pull request #616:
URL: https://github.com/apache/ignite-3/pull/616#discussion_r798500715
##########
File path:
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/marshal/MarshallingValidations.java
##########
@@ -19,14 +19,25 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.function.Function;
import org.apache.ignite.internal.network.serialization.Classes;
import org.jetbrains.annotations.Nullable;
/**
* Validations that are run before marshalling objects.
*/
class MarshallingValidations {
- static void throwIfMarshallingNotSupported(@Nullable Object object) {
+ private final Map<Class<?>, YesNo> whetherInnerClasses = new HashMap<>();
+ private final Map<Class<?>, YesNo> whetherCapturingClosures = new
HashMap<>();
+ private final Map<Class<?>, YesNo> whetherNonSerializableLambdas = new
HashMap<>();
+
+ private final Function<Class<?>, YesNo> isInnerClassFunction =
MarshallingValidations.this::isInnerClass;
+ private final Function<Class<?>, YesNo> isCapturingClosureFunction =
this::isCapturingClosure;
+ private final Function<Class<?>, YesNo> isNonSerializableLambdaFunction =
this::isNonSerializableLambda;
+
+ void throwIfMarshallingNotSupported(@Nullable Object object) {
Review comment:
As agreed on a call, left the caching approach, but squashed the maps.
The idea is that, if we use a descriptor as a medium of the knowledge about
'marshallability' of a class, we still need to look it up in a map (a different
map), but this requires to make quite some changes, and it does not seem to be
worth 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]