Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: separated one CS, added example

...

A class that is loaded by the bootstrap class loader has the authority to call the static factory method Unsafe.getUnsafe(). An average developer would not be able to fulfill this requirement unless the sun.boot.class.path system property is modified. One alternative is to change the accessibility of the field that holds an instance of Unsafe using reflection. This is only possible if the current security manager allows it (by violating SEC32-J. Do not grant ReflectPermission with action target suppressAccessChecks). To throw an undeclared checked exception, the caller just needs to use the Unsafe.throwException() method.

...