...
A class that is loaded by the bootstrap class loader has the authority to call the static
factory method Unsafe.getUnsafe()
. An average developer may be unable 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 guideline ENV04-J. Do not grant ReflectPermission with target suppressAccessChecks.) . To throw an undeclared checked exception, the caller just needs to use the Unsafe.throwException()
method.
...
For further details on implementing the builder pattern, refer to guideline OBJ04-J. Do not allow partially initialized objects to be accessed. In the example described in that ruleguideline, the Currency.Builder
class must implement the Builder interface highlighted in this recommendation.
...
Wiki Markup |
---|
According to the Java API \[[API 2006|AA. Bibliography#API 06]\], class {{Thread}} documentation, |
Wiki Markup \[{{Thread.stop()}}\] may be used to generate exceptions that its target thread is unprepared to handle (including checked exceptions that the thread could not possibly throw, were it not for this method). For example, the following method is behaviorally identical to Java's throw operation, but circumvents the compiler's attempts to guarantee that the calling method has declared all of the checked exceptions that it may throw.
...
Failure to document undeclared checked exceptions can result in checked exceptions that the caller is unprepared to handle. This violates the safety property.
Rule Guideline | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
EXC10-J | low | unlikely | high | P1 | L3 |
...