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

InetAddress:ofLiteral(String) Specification clarification

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 22
    • core-libs

      The specification mentions - https://download.java.net/java/early_access/jdk22/docs/api/java.base/java/net/InetAddress.html#ofLiteral(java.lang.String)

      Returns:
      an InetAddress object with no hostname set, and constructed from the provided IP address literal.

      As I read from the spec the returned InetAddress shall not be associated with any hostname?

      Actual behavior - returns the hostName.
      ===
      Inet4Address inet4Address = Inet4Address.ofLiteral("1.2.3.4");
      System.out.println(inet4Address.getHostName());
      ===

      It's not that clear what is ' no hostname set'.

       

            aefimov Aleksej Efimov
            kganapureddy Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: