...
| Code Block | ||
|---|---|---|
| ||
interface Thr<EXC extends Exception> {
void fn() throws EXC;
}
public class UndeclaredGen {
static void undeclaredThrow() throws RuntimeException {
@SuppressWarnings("unchecked") // Suppresses warnings
Thr<RuntimeException> thr = (Thr<RuntimeException>)(Thr)
new Thr<IOException>() {
public void fn() throws IOException {
throw new IOException();
}
};
thr.fn();
}
public static void main(String[] args) {
undeclaredThrow();
}
}
|
Noncompliant Code Example (Thread.stop(
...
Throwable)
...
)
| Wiki Markup |
|---|
According to the Java API \[[API 2006|AA. Bibliography#API 06]\], class {{Thread}}: |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="8bd49d7d0e13b3c9-359095ba-46264a25-bef783e3-4ecbae3b008dbd53dc3f0017"><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="7d3d063160a4a84a-a92920de-481e43c0-b27f8a95-8ef59179a734db70d06170a0"><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="7927f2f49120f6a7-f4620f94-490e48bd-ae30b110-55e6b1094a789c12130f0e04"><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="3ff607761de05630-ebbbabe4-48a14393-bdbeaaa2-5f31e5c5879f5dd1af2a0e2e"><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="69b84d3b1e353504-dec486c2-46744a4f-897eac84-3fc0cdbd9549cebb9081accf"><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="da87c88324bb03c3-09ce502d-40c341f9-a8f4b172-f3b06a3439bc7c7ddf2a24a4"><ac:plain-text-body><![CDATA[ | [[Venners 2003 | AA. Bibliography#Venners 03]] | Scalability of Checked Exceptions | ]]></ac:plain-text-body></ac:structured-macro> |
...