RFR: 8332181: Deprecate for removal the java.net.MulticastSocket.setTTL/getTTL and the 2-arg send methods [v2]
Daniel Fuchs
dfuchs at openjdk.org
Fri May 17 12:18:01 UTC 2024
On Fri, 17 May 2024 11:47:34 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> 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.
Ah - thank you. I had hoped that adding forRemoval = true to the annotation would allow us to get rid of the SuppressWarning.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19242#discussion_r1604901662
More information about the net-dev
mailing list