This class is needed to work around the protection that disallows polling objectFieldOffset
on Records and hidden classes:
It does so by injecting this class with elevated protection levels with sun.misc.Unsafe.defineAnonymousClass,
and accessing the jdk.internal.misc.Unsafe.objectFieldOffset that does not have
this protection. The class would be injected with java.lang.Object privileges, which
also breaks through the module system protections.
Since j.i.m.Unsafe is not accessible on every JDK, this code falls back gracefully when
it is not available. Since we want to be compilable on lower JDKs (for example 8), we
have to do reflective invocations as well.
This file is normally compiled to bytecode for easier injection. We might have constructed
it at runtime with bytecode manipulation tools.
The whole thing is slow, because it requires going through reflection a few times, but it
should be fine for introspection uses in JOL.