Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8235330

Deprecate MulticastSocket methods that operate on java.net.InetAddress

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 14
    • core-libs
    • None
    • source
    • low
    • The change causes the compiler to generate ordinary deprecation warnings for the methods in question. No usage of theses methods within the JDK.
    • Java API
    • SE

      Summary

      Deprecate, not for removal, the following methods in java.net.MulticastSocket:

       1. MulticastSocket.getInterface()
       2. MulticastSocket.setInterface(InetAddress inf)
       3. MulticastSocket.joinGroup(InetAddress mcastaddr)
       4. MulticastSocket.leaveGroup(InetAddress mcastaddr)
       5. MulticastSocket.getLoopbackMode()
       6. MulticastSocket.setLoopbackMode(boolean disable)

      Problem

      Methods 1 - 4 operate on java.net.InetAddress instead of java.net.NetworkInterface and thus do not allow to pass or return the NetworkInterface set for a MulticastSocket. It is preferred to use NetworkInterface as an InetAddress may not uniquely identify a NetworkInterface.

      Methods 5 - 6 operate on SocketOptions.IP_MULTICAST_LOOP. However, MulticastSocket.setOption conforms with StandardSocketOptions.IP_MULTICAST_LOOP, which should be used instead.

      Solution

      Add the @Deprecated annotation and the @deprecated javadoc tag to the methods in question.

      Specification

      Webrev: http://cr.openjdk.java.net/~jboes/webrevs/8233319/webrev.01/

      Specdiff attached.

            jboes Julia Boes (Inactive)
            chegar Chris Hegarty
            Alan Bateman, Chris Hegarty, Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: