3 ms·
The author's point about the orthogonality of exceptions to values and types still stands; try creating a class like abstract class GenericException<R> ext
by tadfisher 3y ago
The author's point about the orthogonality of exceptions to values and types still stands; try creating a class like
abstract class GenericException<R> extends Exception {
R reason();
}
As it is, Exception is a "special" type that isn't allowed to be used like normal Java types, because Java generics are a leaky abstraction introduced after checked exceptions, and the JVM cannot deal with type erasure in catch blocks.