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

Сергей Цыпанов github.com+10835776+stsypanov at openjdk.java.net
Tue Apr 27 09:20:37 UTC 2021


On Mon, 26 Apr 2021 14:12:01 GMT, Peter Levart <peter.levart at gmail.com> wrote:

> Also be careful not to return a string which
is not interned (which would happen if you did what you are proposing
above).

Ok, I'm probably missing something, but when we move `String.intern()` call to `this.packageName = pn.intern();` there is no case when non-interned String is returned: there's only one assignment to the field `packageName` and the value assigned is always interned, right?

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

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


More information about the core-libs-dev mailing list