RFR: 8344943: Mark not subclassable classes final in java.base exported classes
Chen Liang
liach at openjdk.org
Thu Jan 16 20:42:53 UTC 2025
On Tue, 26 Nov 2024 20:03:39 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Please review this PR which adds the `final` modifier to non-subclassable classes in `java.base`.
>>
>> The classes were identified using an automated analysis. See CSR for details.
>>
>> Besides simply adding the `final` access modifier, the PR:
>>
>> * Updates a note in `java.lang.constant.DynamicCallSiteDesc` to not reference subtypes. See CSR for discussion.
>> * Removes the class `java.lang.Runtime` from the test `test/jdk/jdk/internal/reflect/CallerSensitive/CheckCSMs.java`
>> * Updates the copyright year of affected source files
>
> src/java.base/share/classes/java/net/InterfaceAddress.java line 45:
>
>> 43:
>> 44: /*
>> 45: * Package private constructor. Can't be built directly, instances are
>
> The comment is outdated. This constructor is actually called via JNI like `(*env)->NewObject(env, ni_ibcls, ni_ibctrID)` in `NetworkInterface.c`. I think we need to consult a network engineer to decide what is the best way to comment on this constructor.
A pleasant surprise - since we aren't modifying constructor modifiers, we can put these intricacies on hold. Thanks for limiting the scope of this patch.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22389#discussion_r1859162790
More information about the net-dev
mailing list