If a cache is sized using MemoryUnit, and the cache key or value contains a record (which were added in Java 17), any attempt to put a value in the cache will fail. The core cause of this failure is this line in sun.misc.Unsafe:
if (declaringClass.isRecord()) {
throw new UnsupportedOperationException("can't get field offset on a record class: " + f);
}
A simple project which shows the issue in practice is linked here.
This seems like a serious issue, because Ehcache gives no clear indication of why this failure happens, and records are natural to use as keys.
If a cache is sized using MemoryUnit, and the cache key or value contains a record (which were added in Java 17), any attempt to put a value in the cache will fail. The core cause of this failure is this line in sun.misc.Unsafe:
A simple project which shows the issue in practice is linked here.
This seems like a serious issue, because Ehcache gives no clear indication of why this failure happens, and records are natural to use as keys.