FileDocCategorySizeDatePackage
UncheckedThrow.javaAPI DocAndroid 5.1 API1740Thu Mar 12 22:22:10 GMT 2015android.hardware.camera2.utils

UncheckedThrow

public class UncheckedThrow extends Object
hide

Fields Summary
Constructors Summary
Methods Summary
public static voidthrowAnyException(java.lang.Exception e)
Throw any kind of exception without needing it to be checked

param
e any instance of a Exception

        /**
         *  Abuse type erasure by making the compiler think we are throwing RuntimeException,
         *  which is unchecked, but then inserting any exception in there.
         */
        UncheckedThrow.<RuntimeException>throwAnyImpl(e);
    
public static voidthrowAnyException(java.lang.Throwable e)
Throw any kind of throwable without needing it to be checked

param
e any instance of a Throwable

        /**
         *  Abuse type erasure by making the compiler think we are throwing RuntimeException,
         *  which is unchecked, but then inserting any exception in there.
         */
        UncheckedThrow.<RuntimeException>throwAnyImpl(e);
    
private static voidthrowAnyImpl(java.lang.Throwable e)

        throw (T) e;