Can sun.misc.Unsafe.throwException() be removed?

Johannes Kuhn info at
Tue Aug 4 17:35:00 UTC 2020

 From my understanding, Unsafe.throwException throws the passed 
Throwable, more commonly known as "snaky throws".

There are other ways to archive the same result, one commonly found is 
by (ab)using generics:

     public static <T extends Throwable> void sneakyThrows(Throwable t) 
throws T {
         throw (T) t;

(This will generate an unchecked warning, but that can be silenced with 
the right annotation.)

Is there any reason why this method still needs to exist?
If not, could it be removed?

- Johannes

More information about the core-libs-dev mailing list