Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8241995: Clarify InetSocketAddress::toString specification #2357

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/java.base/share/classes/java/net/InetSocketAddress.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -373,11 +373,18 @@ public final boolean isUnresolved() {

/**
* Constructs a string representation of this InetSocketAddress.
* This String is constructed by calling toString() on the InetAddress
* and concatenating the port number (with a colon). If the address
* is an IPv6 address, the IPv6 literal is enclosed in square brackets.
* This string is constructed by calling {@link InetAddress#toString()}
* on the InetAddress and concatenating the port number (with a colon).
* <p>
* If the address is an IPv6 address, the IPv6 literal is enclosed in
* square brackets, for example: {@code "localhost/[0:0:0:0:0:0:0:1]:80"}.
* If the address is {@linkplain #isUnresolved() unresolved},
* {@code <unresolved>} is displayed in place of the address literal.
* {@code <unresolved>} is displayed in place of the address literal, for
* example {@code "foo/<unresolved>:80"}.
* <p>
* To retrieve a string representation of the hostname or the address, use
* {@link #getHostString()}, rather than parsing the string representation
* returned by this method.
*
* @return a string representation of this object.
*/
Expand Down