zstan commented on code in PR #13391:
URL: https://github.com/apache/ignite/pull/13391#discussion_r3795535195
##########
modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryClassDescriptor.java:
##########
@@ -1096,6 +1096,21 @@ Constructor<?> ctor() {
return ctor;
}
+ /**
+ * Checks whether a class is a Java record without requiring a Java 16
runtime at compile time.
+ *
+ * Records are immutable and the binary marshaller cannot restore their
final fields. Java serialization,
+ * used by the optimized marshaller, supports serializable records
starting with Java 16.
+ *
+ * @param cls Class to check.
+ * @return {@code True} if the class is a record.
+ */
+ private static boolean isRecord(Class<?> cls) {
+ Class<?> superCls = cls.getSuperclass();
+
+ return superCls != null &&
"java.lang.Record".equals(superCls.getName());
Review Comment:
why you avoid to runtime check like : cls.isRecord() here ?
--
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]