I believe that Tcounts RuntimeException. I assume that from making the following change to the code throwAsUncheckedException:
var o = ExceptionUtils.throwAs(t);
... and changing the announcement throwAsto:
private static <T extends Throwable> T throwAs(Throwable t) throws T
(Note that I use varfrom Java 10 so that the compiler infers the type without additional information.)
After compiling and then using, javap -cyou can see what's there checkcastto RuntimeException:
invokestatic
checkcast
astore_1
throwAs , - - , , T, RuntimeException .
JLS 18, :
, αi, αi RuntimeException, Ti = RuntimeException.
Throwable. , , 18 , ", ", .
, throwAsUncheckedException ( ) :
ExceptionUtils.<RuntimeException>throwAs(t);
, . , RuntimeException. , , - , . T ... RuntimeException, . : , , .
JVM , , , , JVM. .