<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.theeggeadventure.com/wikimedia/index.php?action=history&amp;feed=atom&amp;title=X_extends_Exception</id>
	<title>X extends Exception - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.theeggeadventure.com/wikimedia/index.php?action=history&amp;feed=atom&amp;title=X_extends_Exception"/>
	<link rel="alternate" type="text/html" href="https://www.theeggeadventure.com/wikimedia/index.php?title=X_extends_Exception&amp;action=history"/>
	<updated>2026-05-16T05:06:31Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0-beta</generator>
	<entry>
		<id>https://www.theeggeadventure.com/wikimedia/index.php?title=X_extends_Exception&amp;diff=1960&amp;oldid=prev</id>
		<title>Egge: New page: In response to [http://nat.truemesh.com/archives/000738.html Generic Throws: Another Little Java Idiom]  Unfortunately, the &quot;X extends Exception&quot; falls apart fairly quickly with the curren...</title>
		<link rel="alternate" type="text/html" href="https://www.theeggeadventure.com/wikimedia/index.php?title=X_extends_Exception&amp;diff=1960&amp;oldid=prev"/>
		<updated>2008-06-26T12:16:29Z</updated>

		<summary type="html">&lt;p&gt;New page: In response to [http://nat.truemesh.com/archives/000738.html Generic Throws: Another Little Java Idiom]  Unfortunately, the &amp;quot;X extends Exception&amp;quot; falls apart fairly quickly with the curren...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;In response to [http://nat.truemesh.com/archives/000738.html Generic Throws: Another Little Java Idiom]&lt;br /&gt;
&lt;br /&gt;
Unfortunately, the &amp;quot;X extends Exception&amp;quot; falls apart fairly quickly with the current generation of type erasure.  You can get a little way down this path, but soon you&amp;#039;ll hit string compile errors, which go away, depending on the order in which you compile / recompile things.  The problem is two fold:&lt;br /&gt;
# Java has type erasure&lt;br /&gt;
# RuntimeException extends Exception, but doesn&amp;#039;t have to be declared in a throws clause. &lt;br /&gt;
&lt;br /&gt;
So, the compiler may or may not be able to determine if a method throws a typed exception.  &lt;br /&gt;
&lt;br /&gt;
If this technique worked, it would be useful for implementing closure like features.  For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;geshi lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
public interface BlockBase&amp;lt;I, O, X extends Throwable&amp;gt; {&lt;br /&gt;
    O eval(I item) throws X;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
    public &amp;lt;X extends Throwable&amp;gt; RArray&amp;lt;T&amp;gt; findAll(BlockBase&amp;lt;T, Boolean, X&amp;gt; block) throws X {&lt;br /&gt;
        RArray&amp;lt;T&amp;gt; arr = new RArray&amp;lt;T&amp;gt;();&lt;br /&gt;
        for (T t : this) {&lt;br /&gt;
            if (block.eval(t)) {&lt;br /&gt;
                arr.append(t);&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        return arr;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/geshi&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You&amp;#039;ll notice in code like [http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166ydocs/jsr166y/forkjoin/package-summary.html fork-join] framework, they rely wholly on unchecked exceptions.  &lt;br /&gt;
&lt;br /&gt;
[[Category:Java]]&lt;/div&gt;</summary>
		<author><name>Egge</name></author>
	</entry>
</feed>