From ce99198e3a6dc81865c518b1fe4a67e93b8ebdd1 Mon Sep 17 00:00:00 2001 From: Jaikiran Pai Date: Tue, 21 May 2024 06:37:15 +0000 Subject: [PATCH] 8332181: Deprecate for removal the MulticastSocket.send(DatagramPacket, byte) and setTTL/getTTL methods on DatagramSocketImpl and MulticastSocket Reviewed-by: dfuchs, iris, alanb --- .../share/classes/java/net/DatagramSocketImpl.java | 6 +++--- src/java.base/share/classes/java/net/MulticastSocket.java | 8 ++++---- .../share/classes/java/net/NetMulticastSocket.java | 7 +++---- .../share/classes/sun/nio/ch/DatagramSocketAdaptor.java | 8 ++++---- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/java.base/share/classes/java/net/DatagramSocketImpl.java b/src/java.base/share/classes/java/net/DatagramSocketImpl.java index c0b282bab56c7..54093a9d5f106 100644 --- a/src/java.base/share/classes/java/net/DatagramSocketImpl.java +++ b/src/java.base/share/classes/java/net/DatagramSocketImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -171,7 +171,7 @@ protected void disconnect() { * the time-to-live option. * @see #getTTL() */ - @Deprecated + @Deprecated(forRemoval = true, since = "1.2") protected abstract void setTTL(byte ttl) throws IOException; /** @@ -183,7 +183,7 @@ protected void disconnect() { * @return a byte representing the TTL value * @see #setTTL(byte) */ - @Deprecated + @Deprecated(forRemoval = true, since = "1.2") protected abstract byte getTTL() throws IOException; /** diff --git a/src/java.base/share/classes/java/net/MulticastSocket.java b/src/java.base/share/classes/java/net/MulticastSocket.java index 8103aade5ca36..9a9d57118c0f1 100644 --- a/src/java.base/share/classes/java/net/MulticastSocket.java +++ b/src/java.base/share/classes/java/net/MulticastSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -226,7 +226,7 @@ public MulticastSocket(SocketAddress bindaddr) throws IOException { * int instead of byte as the type for ttl. * @see #getTTL() */ - @Deprecated + @Deprecated(forRemoval = true, since = "1.2") public void setTTL(byte ttl) throws IOException { delegate().setTTL(ttl); } @@ -271,7 +271,7 @@ public void setTimeToLive(int ttl) throws IOException { * which returns an int instead of a byte. * @see #setTTL(byte) */ - @Deprecated + @Deprecated(forRemoval = true, since = "1.2") public byte getTTL() throws IOException { return delegate().getTTL(); } @@ -561,7 +561,7 @@ public boolean getLoopbackMode() throws SocketException { * @see SecurityManager#checkMulticast(java.net.InetAddress, byte) * @see SecurityManager#checkConnect */ - @Deprecated + @Deprecated(forRemoval = true, since = "1.4") public void send(DatagramPacket p, byte ttl) throws IOException { delegate().send(p, ttl); diff --git a/src/java.base/share/classes/java/net/NetMulticastSocket.java b/src/java.base/share/classes/java/net/NetMulticastSocket.java index 4160156997a27..e7aed881feeeb 100644 --- a/src/java.base/share/classes/java/net/NetMulticastSocket.java +++ b/src/java.base/share/classes/java/net/NetMulticastSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -650,8 +650,8 @@ public Set> supportedOptions() { */ private InetAddress infAddress = null; - @Deprecated @Override + @SuppressWarnings("removal") public void setTTL(byte ttl) throws IOException { if (isClosed()) throw new SocketException("Socket is closed"); @@ -668,8 +668,8 @@ public void setTimeToLive(int ttl) throws IOException { getImpl().setTimeToLive(ttl); } - @Deprecated @Override + @SuppressWarnings("removal") public byte getTTL() throws IOException { if (isClosed()) throw new SocketException("Socket is closed"); @@ -884,7 +884,6 @@ public boolean getLoopbackMode() throws SocketException { } @SuppressWarnings("removal") - @Deprecated @Override public void send(DatagramPacket p, byte ttl) throws IOException { diff --git a/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java b/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java index 8826cc3c188db..324c481f8a819 100644 --- a/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java +++ b/src/java.base/share/classes/sun/nio/ch/DatagramSocketAdaptor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -401,7 +401,7 @@ public Set> supportedOptions() { private InetAddress outgoingInetAddress; @Override - @Deprecated + @SuppressWarnings("removal") public void setTTL(byte ttl) throws IOException { setTimeToLive(Byte.toUnsignedInt(ttl)); } @@ -417,7 +417,7 @@ public void setTimeToLive(int ttl) throws IOException { } @Override - @Deprecated + @SuppressWarnings("removal") public byte getTTL() throws IOException { return (byte) getTimeToLive(); } @@ -592,7 +592,7 @@ public boolean getLoopbackMode() throws SocketException { } @Override - @Deprecated + @SuppressWarnings("removal") public void send(DatagramPacket p, byte ttl) throws IOException { sendLock.lock(); try {