From 3491a93cec76b80c751678488da72d9c237b65af Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Mon, 7 Oct 2024 11:09:49 -0400 Subject: [PATCH] Annotate some new `java.net` APIs. (#86) --- src/java.base/share/classes/java/net/DatagramSocket.java | 4 ++-- src/java.base/share/classes/java/net/URL.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/net/DatagramSocket.java b/src/java.base/share/classes/java/net/DatagramSocket.java index f9332f9d652..97c2e0d017f 100644 --- a/src/java.base/share/classes/java/net/DatagramSocket.java +++ b/src/java.base/share/classes/java/net/DatagramSocket.java @@ -1329,7 +1329,7 @@ public Set> supportedOptions() { * @see StandardSocketOptions#IP_MULTICAST_IF * @since 17 */ - public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) + public void joinGroup(SocketAddress mcastaddr, @Nullable NetworkInterface netIf) throws IOException { delegate().joinGroup(mcastaddr, netIf); } @@ -1373,7 +1373,7 @@ public void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf) * @see StandardSocketOptions#IP_MULTICAST_IF * @since 17 */ - public void leaveGroup(SocketAddress mcastaddr, NetworkInterface netIf) + public void leaveGroup(SocketAddress mcastaddr, @Nullable NetworkInterface netIf) throws IOException { delegate().leaveGroup(mcastaddr, netIf); } diff --git a/src/java.base/share/classes/java/net/URL.java b/src/java.base/share/classes/java/net/URL.java index 435cd62ab9d..23db6137ee0 100644 --- a/src/java.base/share/classes/java/net/URL.java +++ b/src/java.base/share/classes/java/net/URL.java @@ -860,7 +860,7 @@ public URL(@Nullable URL context, String spec, @Nullable URLStreamHandler handle * * @since 20 */ - public static URL of(URI uri, URLStreamHandler handler) + public static URL of(URI uri, @Nullable URLStreamHandler handler) throws MalformedURLException { if (!uri.isAbsolute()) { throw new IllegalArgumentException("URI is not absolute");