Github user kinow commented on a diff in the pull request:

    https://github.com/apache/commons-lang/pull/98#discussion_r32883445
  
    --- Diff: src/main/java/org/apache/commons/lang3/exception/ThrowUtils.java 
---
    @@ -0,0 +1,35 @@
    +package org.apache.commons.lang3.exception;
    +
    +/**
    + * @author <a href="mailto:[email protected]";>Gregory Zak</a>
    + *
    + * <p>Utility class containing a method to allow checked exceptions to be 
rethrown without explicitly
    + * declaring them.</p>
    + *
    + */
    +public final class ThrowUtils {
    +
    +    private ThrowUtils() {
    +    }
    +
    +    /**
    +     * <p>Any method with uninteresting checked exceptions in the body can 
simply be wrapped in a
    +     * try/catch block, and the exceptions can then be freely rethrown 
from the catch block using
    +     * {@code rethrow(t)}. If a method requires a return value, simply use 
{@code return rethrow(t)}
    +     * in the catch block and compiler type inference will do the rest (no 
need to manually capture
    +     * a return variable in the try block and return it after the catch 
block).</p>
    +     *
    +     * @param throwable The throwable to rethrow
    +     * @param <R> Used only for compiler type inference
    +     * @return Never returns, always throws
    +     */
    +    public static <R> R rethrow(Throwable throwable) {
    +        return ThrowUtils.<R, RuntimeException>rethrow0(throwable);
    +    }
    +
    +    @SuppressWarnings("unchecked")
    +    private static <R, T extends Throwable> R rethrow0(Throwable 
throwable) throws T {
    --- End diff --
    
    A JavaDoc comment is necessary or it will add a CheckStyle error.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to