以下の内容はhttps://unageanu.hatenablog.com/entry/20080521/1211374584より取得しました。


型パラメータを受け付ける例外は作成できない。

class TestException<T> extends Exception {}

↑みたいな例外を作成しようとしてエラーに。「The Java Language Specification」を読むと8.1.2 Generic Classes and Type Parametersに記載があった。

It is a compile-time error if a generic class is a direct or indirect subclass of Throwable.

「この制約は、ジェネリックを使用しないクラスでも「try .. catch」が正しく動作するようにするために必要」とのこと。

This restriction is needed since the catch mechanism of the Java virtual machine works only with non-generic classes

ふむ。




以上の内容はhttps://unageanu.hatenablog.com/entry/20080521/1211374584より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14