On Mon, 26 Jun 2023 13:51:25 GMT, Chen Liang <li...@openjdk.org> wrote:

>> This patch touches java.lang.reflect and java.lang.invoke packages. It 
>> replaces instanceof + cast with pattern matching and updates  
>> Array.newInstance().getClass() patterns with arrayType() for obtaining array 
>> types of a class.
>
> Chen Liang has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   simplify equals by replacing if with and operators

src/java.base/share/classes/java/lang/invoke/MemberName.java line 995:

> 993:                 return result;
> 994:             ReflectiveOperationException ex = 
> result.makeAccessException();
> 995:             if (ex instanceof IllegalAccessException iae)  throw iae;

Suggestion:

            if (ex instanceof IllegalAccessException iae) throw iae;

src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java line 189:

> 187:     static Error uncaughtException(Throwable ex) {
> 188:         if (ex instanceof Error error)  throw error;
> 189:         if (ex instanceof RuntimeException re)  throw re;

Suggestion:

        if (ex instanceof Error error) throw error;
        if (ex instanceof RuntimeException re) throw re;

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14642#discussion_r1242756653
PR Review Comment: https://git.openjdk.org/jdk/pull/14642#discussion_r1242757121

Reply via email to