RFR: 8261880: Change nested classes in java.base to static nested classes where possible [v2]
liach
github.com+7806504+liach at openjdk.java.net
Wed Feb 17 16:38:04 UTC 2021
On Wed, 17 Feb 2021 16:32:39 GMT, Сергей Цыпанов <github.com+10835776+stsypanov at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java line 192:
>>
>>> 190:
>>> 191: /* Placeholder class for DelegatingMethodHandles generated ahead of time */
>>> 192: static final class Holder {}
>>
>> For the four `Holder` classes in `java.lang.invoke`, the class is generated when running jlink via `java.lang.invoke.GenerateJLIClassesHelper`. To stay in sync with the definition you'd have to update that code. Also, since these `Holder` classes will only contain static methods and are never instantiated then I'm not sure it matters whether the classes are static or not.
>
> I'll just revert them
For static methods, since in java language you cannot declare static method in instance inner classes, I'd say making them static makes more sense language-wise. Also making them static reduces compiler synthetic instance field and constructors.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2589
More information about the security-dev
mailing list