All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.junit.internal.Throwables Maven / Gradle / Ivy

Go to download

Everything needed to run a comprehensive dev environment. Just type X_ and pick a service from autocomplete; new dev modules will be added as they are built. The only dev service not included in the uber jar is xapi-dev-maven, as it includes all runtime dependencies of maven, adding ~4 seconds to build time, and 6 megabytes to the final output jar size (without xapi-dev-maven, it's ~1MB).

The newest version!
package org.junit.internal;

/**
 * Miscellaneous functions dealing with {@code Throwable}.
 *
 * @author [email protected] (Kevin Cooney)
 * @since 4.12
 */
public final class Throwables {

    private Throwables() {
    }

    /**
     * Rethrows the given {@code Throwable}, allowing the caller to
     * declare that it throws {@code Exception}. This is useful when
     * your callers have nothing reasonable they can do when a
     * {@code Throwable} is thrown. This is declared to return {@code Exception}
     * so it can be used in a {@code throw} clause:
     * 
     * try {
     *   doSomething();
     * } catch (Throwable e} {
     *   throw Throwables.rethrowAsException(e);
     * }
     * doSomethingLater();
     * 
* * @param e exception to rethrow * @return does not return anything * @since 4.12 */ public static Exception rethrowAsException(Throwable e) throws Exception { Throwables.rethrow(e); return null; // we never get here } @SuppressWarnings("unchecked") private static void rethrow(Throwable e) throws T { throw (T) e; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy