...
Classes that are loaded by the bootstrap class loader have the permissions needed to call the static
factory method Unsafe.getUnsafe()
. Arranging to have an arbitrary class loaded by the bootstrap class loader without modifying the sun.boot.class.path
system property can be difficult. However, an alternative way to gain access is to change the accessibility of the field that holds an instance of Unsafe
through the use of reflection. This works only when permitted by the current security manager (which would violate rule ENV04ENV03-J. Do not grant ReflectPermission with target suppressAccessChecksdangerous combinations of permissions). Given access to Unsafe
, a call can throw an undeclared checked exception by calling the Unsafe.throwException()
method.
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="81093041c479b4ca-5e4a15ff-491441df-a9a1a41d-c7d7f77ce48a2431b26341c5"><ac:plain-text-body><![CDATA[ | [[Bloch 2008 | AA. Bibliography#Bloch 08]] | Item 2: "Consider a builder when faced with many constructor parameters" | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f5d6497c21576579-1aab0c65-4c65401d-afffa4b1-51f17b52468cc90462de6d93"><ac:plain-text-body><![CDATA[ | [[Goetz 2004b | AA. Bibliography#Goetz 04b]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="55d9664e891d7e8b-6a5268ed-47854080-a402afd7-c29f124f6b64b14e293aae86"><ac:plain-text-body><![CDATA[ | [[JLS 2005 | AA. Bibliography#JLS 05]] | Chapter 11: Exceptions | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f2b55d2c5121417d-a29e1f7d-4d7d4592-bcd69f74-925e07f3d9e66a497085c8f8"><ac:plain-text-body><![CDATA[ | [[Roubtsov 2003 | AA. Bibliography#Roubtsov 03]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="63683f19f9c9195b-e42484c5-4dcb4a34-9116a1c5-fe56b4e271ddc37e25afdda8"><ac:plain-text-body><![CDATA[ | [[Schwarz 2004 | AA. Bibliography#Schwarz 04]] |
| ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="cb5d1308462082a0-d98a9a20-447b46ba-bcbdad16-6d7e025ed4898d782c46172b"><ac:plain-text-body><![CDATA[ | [[Venners 2003 | AA. Bibliography#Venners 03]] | "Scalability of Checked Exceptions" | ]]></ac:plain-text-body></ac:structured-macro> |
...