RFR: 8337143: (fc, fs) Move filesystem-related native objects from libnio to libjava [v4]

Brian Burkhalter bpb at openjdk.org
Fri Aug 9 17:59:12 UTC 2024


On Fri, 9 Aug 2024 15:58:50 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> I see. Inet6AddressImpl and Inet4AddressImpl are symetric classes implementing InetAddressImpl. Both will make native calls to the "net" library - so both require the library to be loaded.
>> 
>> In the JDK, these two classes are only loaded by InetAddress, after the "net" library has been loaded.
>> 
>> The test test java/net/InetAddress/NullCharInHostnameDriver.java seems to be an outlier (@AlekseiEfimov ?) which for some reason uses a private API (the test is injected in java.base) and create a new instance of Inet6AddressImpl before InetAddress is loaded. This is why without this change to Inet6AddressImpl we get the UnsatisfiedLinkError. We would have gotten the same from Inet4AddressImpl if the test had first required access to Inet4AddressImpl instead.
>> 
>> So it seems that we should either add the call to load the "net" library to both Inet6AddressImpl and Inet4AddressImpl for symetry (there doesn't seem to be any reason why Inet6AddressImpl would be preferred in this respect),  or remove this call from Inet6AddressImpl and add it to the test instead. Adding the call to jdk.internal.loader.BootLoader.loadLibrary("net"); in the test should work since the actual test class (NullCharInHostname.java) is injected in java.base.
>
> Thanks. I'll try adding it to the test.

In f57b6f1 I reverted the Inet6AddressImpl change and added the "net" library load to NullCharInHostname.java. With this change the test passed on Unix.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20317#discussion_r1711895017


More information about the core-libs-dev mailing list