IGNITE-13286 Support Java records in binary marshaller - #13391
Conversation
|
Fixes the Hibernate 7 query-cache incompatibility caused by Java records. |
|
Hi maintainers, following up on this PR since it has been open for several weeks without review. The record-handling fix and regression coverage are ready for review, and I am happy to rebase or revise the approach based on feedback. Thank you. |
| private static boolean isRecord(Class<?> cls) { | ||
| Class<?> superCls = cls.getSuperclass(); | ||
|
|
||
| return superCls != null && "java.lang.Record".equals(superCls.getName()); |
There was a problem hiding this comment.
why you avoid to runtime check like : cls.isRecord() here ?
| * @throws Exception If failed. | ||
| */ | ||
| @Test | ||
| public void testSerializableRecord() throws Exception { |
There was a problem hiding this comment.
apache ignite master currently support only 17 java - thus i suppose you can simplify this test and rewrite it like other presented here ? Also you need this PR agains master branch, not against ignite-2.17
|
IGNITE-13286 - is different issue and not related to this activity |
Summary
nnRoutes Java records through Ignite's optimized Java-serialization path, avoidingUnsafe.objectFieldOffset()on immutable record fields.nn## Root causennHibernate 7 uses a serializable record forQueryResultsCacheImpl.CacheItem. Ignite's reflective binary marshaller attempts to obtain unsafe offsets for record fields, which modern JDKs reject.nn## Changesnn- Detect records without introducing a Java 16 compile-time dependency.n- UseOptimizedMarshallerfor records.n- Make the developer warning accurately include records.n- Add a runtime-compiled serializable-record round-trip regression test; it runs on JDK 16+ and skips on older JDKs.nn## Verificationnn- Rebased on currentignite-2.17andgit diff --checkpasses.n- All 4,531ignite-coreproduction sources compile successfully on JDK 25.n- Focused test execution is blocked during unrelated full test compilation because JDK 25 removedThread.suspend()andThread.resume(), which legacy Ignite tests still reference. A supported JDK 17 is not installed locally.n- Existing GitHub check failures are fork checkout-security refusals before code execution, not test failures.nnFixes #13286