InetAddress:ofLiteral(String) Specification clarification

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P3
    • tbd
    • Affects Version/s: 22
    • Component/s: 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'.

       

            Assignee:
            Aleksej Efimov
            Reporter:
            Krushnareddy Ganapureddy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: