RFR: 8265418: Clean-up redundant null-checks of Class.getPackageName() [v3]

Claes Redestad redestad at openjdk.java.net
Thu May 27 12:04:07 UTC 2021


On Thu, 27 May 2021 11:19:24 GMT, Сергей Цыпанов <github.com+10835776+stsypanov at openjdk.org> wrote:

>> As discussed in https://github.com/openjdk/jdk/pull/3464 we can clean-up null-checks remaining after [8142968](https://bugs.openjdk.java.net/browse/JDK-8142968) as Class.getPackageName() never returns null.
>
> Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8265418: Compare package names with == instead of equals()

LGTM

src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java line 129:

> 127:         while (clazz.isArray()) {
> 128:             clazz = clazz.getComponentType();
> 129:         }

Pre-existing issue (so consider filing a follow-up) but this loop is redundant since `getPackageName` will already return the package name of the innermost component type.

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

Marked as reviewed by redestad (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3571


More information about the core-libs-dev mailing list