> Can not we define an parametrized exception class?...
> lichuan...@gmail.com wrote:
> > Can not we define an parametrized exception class?...
[quoted text clipped - 3 lines]
>
> piotr
Thanks, I understood now as: due to the type erasure, T in a generics
declaration actually becomes the Object type in bytecodes at runtime.
That also answers why we can create a raw type without
paramatrization. Anything is an object ..... Generics is a compiling
time magic for type safy...
Lew - 16 Nov 2007 15:32 GMT
>> lichuan...@gmail.com wrote:
>>> Can not we define an parametrized exception class?...
[quoted text clipped - 8 lines]
> paramatrization. Anything is an object ..... Generics is a compiling
> time magic for type safy...
Better still to quote the law,
<http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.1.2>
> It is a compile-time error if a generic class is a direct or indirect subclass of Throwable.
OTOH, it's perfectly fine for Exceptions to be type parameters in a generic
declaration.
public class Handler <T extends Exception> ...

Signature
Lew