RFR: 8313743: Make fields final in sun.nio.ch

Alan Bateman alanb at openjdk.org
Fri Aug 4 10:41:33 UTC 2023


On Fri, 21 Jul 2023 22:35:37 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:

> Found a few fields in `sun.nio.ch` package which could be declared `final`.
> 
> Also I took oportunity to make a couple of cleanups:
> 1. Converted `sun.nio.ch.OptionKey` to a record. Getters naming are already match.
> 2. Removed `sun.nio.ch.WindowsAsynchronousSocketChannelImpl#addressSize`/`sun.nio.ch.WindowsSelectorImpl#addressSize` fields. Address size is already cached inside Unsafe (since [JDK-8221477](https://bugs.openjdk.org/browse/JDK-8221477)).

Can you check the copyright date on the modified files, looks like some will need to be updated.

src/java.base/share/classes/sun/nio/ch/OptionKey.java line 31:

> 29:  * Represents the level/name of a socket option
> 30:  */
> 31: record OptionKey(int level, int name) {

This changes equality, will need to examine the usages in generated code to check that it is okay.

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

PR Comment: https://git.openjdk.org/jdk/pull/14980#issuecomment-1665399957
PR Review Comment: https://git.openjdk.org/jdk/pull/14980#discussion_r1284265185


More information about the nio-dev mailing list