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

Alan Bateman alanb at openjdk.java.net
Mon Apr 19 14:48:38 UTC 2021


On Mon, 19 Apr 2021 14:05:31 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.

src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java line 458:

> 456:         private static boolean isSamePackage(Class<?> class1, Class<?> class2) {
> 457:             return class1.getClassLoader() == class2.getClassLoader()
> 458:                    && class1.getPackageName().equals(class2.getPackageName());

If the j.u.c.atomic code is changed then it will need to be coordinated with Doug Lea's repo. The rest of the changes are good and thanks for following up from the comments in the other issue.

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

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


More information about the core-libs-dev mailing list