I just noticed that the line
return !isChecked(throwable)
Means that if throwable is null then it will be considered unchecked. I
will fix that tomorrow by doing
Return throwable ! null && throwable instanceof Exception;

On Mon, 3 Jul 2023, 01:20 Gary Gregory, <[email protected]> wrote:

> Hi Elliotte:
>
> Might you be looking at some old code in the PR?
>
> The current code is:
>
>     /**
>      * Checks if a throwable represents a checked exception
>      *
>      * @param throwable
>      *            The throwable to check.
>      * @return True if the given Throwable is a checked exception.
>      * @since 3.13.0
>      */
>     public static boolean isChecked(final Throwable throwable) {
>         return throwable != null && !(throwable instanceof Error) &&
> !(throwable instanceof RuntimeException);
>     }
>
>     /**
>      * Checks if a throwable represents an unchecked exception
>      *
>      * @param throwable
>      *            The throwable to check.
>      * @return True if the given Throwable is an unchecked exception.
>      * @since 3.13.0
>      */
>     public static boolean isUnchecked(final Throwable throwable) {
>         return !isChecked(throwable);
>     }
>
> Gary
>
> On Sun, Jul 2, 2023 at 8:01 PM Elliotte Rusty Harold <[email protected]>
> wrote:
> >
> > On Sun, Jul 2, 2023 at 8:53 PM Alex Herbert <[email protected]>
> wrote:
> >
> > >     public static boolean isUnchecked(final Throwable throwable) {
> > >         return (throwable instanceof Error) || (throwable instanceof
> > > RuntimeException);
> > >     }
> >
> > Not quite. It's also possible for someone to define a subclass of
> > Throwable directly that is neither an Exception nor an Error.
> >
> >
> > --
> > Elliotte Rusty Harold
> > [email protected]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to