RFR: 8332181: Deprecate for removal the java.net.MulticastSocket.setTTL/getTTL and the 2-arg send methods [v2]

Jaikiran Pai jpai at openjdk.org
Fri May 17 11:50:15 UTC 2024


On Fri, 17 May 2024 11:09:31 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   also add forRemoval in internal classes
>
> src/java.base/share/classes/java/net/NetMulticastSocket.java line 655:
> 
>> 653:     @Deprecated
>> 654:     @Override
>> 655:     @SuppressWarnings("removal")
> 
> Instead of adding `@SuppressWarning("removal")` here (and at other places below) - would it make sense to update the `@Deprecated` annotation and add `forRemoval = true`?

We will still have to add the `@SuppressWarning("removal")` to these methods otherwise the compilation generates a warning which fails the build:


java.base/share/classes/java/net/NetMulticastSocket.java:655: warning: [removal] setTTL(byte) in MulticastSocket has been deprecated and marked for removal
    public void setTTL(byte ttl) throws IOException {
                ^
java.base/share/classes/java/net/NetMulticastSocket.java:673: warning: [removal] getTTL() in MulticastSocket has been deprecated and marked for removal
    public byte getTTL() throws IOException {
                ^
error: warnings found and -Werror specified
1 error
2 warnings


I went ahead and updated these internal `NetMulticastSocket` and `DatagramSocketAdaptor` classes to add the `forRemoval` attribute to the `@Deprecated` annotation to keep it consistent.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19242#discussion_r1604848467


More information about the net-dev mailing list