Support IPV6_ADDR_PREFERENCES until Java 24 and beyond #1007
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While reflection on Java's internals is slowly being crippled, Unsafe access is still possible (at least until JEP 417 [0] reaches phase 3 in Java 26 or later).
This requires moving from DatagramSocket to DatagramChannel as the former is substantially rewritten in Java 15 (JEP 373, see [1]) as a wrapper around the latter. The channel-based socket cannot be used in Java versions prior to 14 due to Java bug JDK-8232673 [2] which prevents read/write concurrency, effectively stalling the node.
Tested on OpenJDK 8, 11, 17, 21, 23, and 24.
Fixes bug 07217.
[0] https://openjdk.org/jeps/471
[1] https://openjdk.org/jeps/373
[2] https://bugs.openjdk.org/browse/JDK-8232673