2626package java .net ;
2727
2828import org .checkerframework .checker .interning .qual .UsesObjectEquals ;
29+ import org .checkerframework .checker .nullness .qual .Nullable ;
2930import org .checkerframework .framework .qual .AnnotatedFor ;
3031
3132import java .io .IOException ;
248249 * @see java.nio.channels.DatagramChannel
249250 * @since 1.0
250251 */
251- @ AnnotatedFor ({"interning" })
252+ @ AnnotatedFor ({"interning" , "nullness" })
252253public @ UsesObjectEquals class DatagramSocket implements java .io .Closeable {
253254
254255 // An instance of DatagramSocketAdaptor, NetMulticastSocket, or null
@@ -330,7 +331,7 @@ protected DatagramSocket(DatagramSocketImpl impl) {
330331 * @see SecurityManager#checkListen
331332 * @since 1.4
332333 */
333- public DatagramSocket (SocketAddress bindaddr ) throws SocketException {
334+ public DatagramSocket (@ Nullable SocketAddress bindaddr ) throws SocketException {
334335 this (createDelegate (bindaddr , DatagramSocket .class ));
335336 }
336337
@@ -389,7 +390,7 @@ public DatagramSocket(int port) throws SocketException {
389390 * @see SecurityManager#checkListen
390391 * @since 1.1
391392 */
392- public DatagramSocket (int port , InetAddress laddr ) throws SocketException {
393+ public DatagramSocket (int port , @ Nullable InetAddress laddr ) throws SocketException {
393394 this (new InetSocketAddress (laddr , port ));
394395 }
395396
@@ -408,7 +409,7 @@ public DatagramSocket(int port, InetAddress laddr) throws SocketException {
408409 * not supported by this socket.
409410 * @since 1.4
410411 */
411- public void bind (SocketAddress addr ) throws SocketException {
412+ public void bind (@ Nullable SocketAddress addr ) throws SocketException {
412413 delegate ().bind (addr );
413414 }
414415
@@ -569,7 +570,7 @@ public boolean isConnected() {
569570 * @return the address to which this socket is connected.
570571 * @since 1.2
571572 */
572- public InetAddress getInetAddress () {
573+ public @ Nullable InetAddress getInetAddress () {
573574 return delegate ().getInetAddress ();
574575 }
575576
@@ -604,7 +605,7 @@ public int getPort() {
604605 * @see #connect(SocketAddress)
605606 * @since 1.4
606607 */
607- public SocketAddress getRemoteSocketAddress () {
608+ public @ Nullable SocketAddress getRemoteSocketAddress () {
608609 return delegate ().getRemoteSocketAddress ();
609610 }
610611
@@ -618,7 +619,7 @@ public SocketAddress getRemoteSocketAddress() {
618619 * @see #bind(SocketAddress)
619620 * @since 1.4
620621 */
621- public SocketAddress getLocalSocketAddress () {
622+ public @ Nullable SocketAddress getLocalSocketAddress () {
622623 return delegate ().getLocalSocketAddress ();
623624 }
624625
@@ -722,7 +723,7 @@ public void receive(DatagramPacket p) throws IOException {
722723 * method does not allow the operation
723724 * @since 1.1
724725 */
725- public InetAddress getLocalAddress () {
726+ public @ Nullable InetAddress getLocalAddress () {
726727 return delegate ().getLocalAddress ();
727728 }
728729
@@ -1102,7 +1103,7 @@ public boolean isClosed() {
11021103 *
11031104 * @since 1.4
11041105 */
1105- public DatagramChannel getChannel () {
1106+ public @ Nullable DatagramChannel getChannel () {
11061107 return null ;
11071108 }
11081109
0 commit comments