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

Alan Bateman alanb at openjdk.java.net
Fri May 28 11:06:10 UTC 2021


On Fri, 28 May 2021 06:41:51 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Сергей Цыпанов has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8265418: Compare package names with == instead of equals()
>
> I see this has been integrated but I have concerns that the use-sites now all assume that the package name has been intern'ed. We may some crumbs, maybe in an implNote or comment in the Class::getPackageName code, otherwise we risk breakage if getPackageName changed to return a non-intern'ed string at some point.

> @AlanBateman should I then add an implNote to explicitly specify that returned value must be interned?

We need to think about this. It's we are 200% sure it will always be intern'ed then it could be specified. If we aren't sure and document it in an implNote then I've doubt that code outside of the JDK may rely on it and we'll never be able to change it.

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

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


More information about the core-libs-dev mailing list