On Sat, 30 Nov 2024 18:18:29 GMT, Eirik Bjørsnøs <eir...@openjdk.org> wrote:
> Please review this PR which suggests to make the constructor of > `java.net.InterfaceAddress` private. > > This constructor is only accessed by native code via the `NetworkInterface` > class. Making it private would express the intent of this class as being > non-subclassable. > > The comment of the constructor is updated to reflect the new access modifier > as well as to make it clear that the constructor is not to be invoked from > Java code and that instances are obtained from `NetworkInterface` via native > code. > > Marking this class final is handled separately in JDK-8344943 via a CSR. Verification: Ran tests such as `NetworkPrefixLength` to verify that native code can access the now-private constructor. Stack trace in debugger: at java.base/java.net.InterfaceAddress.<init>(InterfaceAddress.java:49) at java.base/java.net.NetworkInterface.getAll(Native Method) at java.base/java.net.NetworkInterface.getNetworkInterfaces(NetworkInterface.java:354) ------------- PR Comment: https://git.openjdk.org/jdk/pull/22467#issuecomment-2509134943