RFR: 8297778: Modernize and improve module jdk.sctp [v4]
Sergey Tsypanov
stsypanov at openjdk.org
Wed Nov 30 12:12:59 UTC 2022
On Wed, 30 Nov 2022 09:55:54 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This PR proposes a variety of modernisations to the `jdk.sctp` module.
>>
>> During the fix of https://bugs.openjdk.org/browse/JDK-8296024, several improvement areas were identified including:
>>
>> * Replacing duplicate code segments
>> * Making certain fields final
>> * Using enhanced switch
>> * Using records
>> * Fixing typos
>> * Marking fields participating in serialisation with `@Serial`
>> * Modernizing toString() implementations
>> * Using pattern matching
>> * Using diamond operators
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>
> Revert more formatting
src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java line 82:
> 80:
> 81: /* IDs of native threads doing send and receive, for signalling */
> 82: private volatile long receiverThread = 0;
It's not necessary to explicitly initialize volatiles with default values, see https://bugs.openjdk.org/browse/JDK-8272756
src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpChannelImpl.java line 1084:
> 1082: IOUtil.load(); /* loads nio & net native libraries */
> 1083: java.security.AccessController.doPrivileged(
> 1084: new java.security.PrivilegedAction<>() {
Is it possible to use `import java.security.PrivilegedAction;` instead of fully-qualified name?
-------------
PR: https://git.openjdk.org/jdk/pull/11418
More information about the net-dev
mailing list