@@ -45,25 +45,24 @@ public static ManagedChannelBuilder<?> forAddress(String name, int port) {
4545 }
4646
4747 /**
48- * Creates a channel with a target string, which can be either a valid {@link
49- * NameResolver}-compliant URI, or an authority string.
48+ * Creates a channel with a target string, which can be either an RFC 3986 URI, or an authority
49+ * string.
5050 *
51- * <p>A {@code NameResolver}-compliant URI is an absolute hierarchical URI as defined by {@link
52- * java.net.URI}. Example URIs:
51+ * <p>Example URIs:
5352 * <ul>
5453 * <li>{@code "dns:///foo.googleapis.com:8080"}</li>
5554 * <li>{@code "dns:///foo.googleapis.com"}</li>
5655 * <li>{@code "dns:///%5B2001:db8:85a3:8d3:1319:8a2e:370:7348%5D:443"}</li>
5756 * <li>{@code "dns://8.8.8.8/foo.googleapis.com:8080"}</li>
5857 * <li>{@code "dns://8.8.8.8/foo.googleapis.com"}</li>
5958 * <li>{@code "zookeeper://zk.example.com:9900/example_service"}</li>
59+ * <li>{@code "intent:#Intent;package=com.some.app;action=a;category=c;end;"}</li>
6060 * </ul>
6161 *
62- * <p>An authority string will be converted to a {@code NameResolver}-compliant URI, which has
63- * the scheme from the name resolver with the highest priority (e.g. {@code "dns"}),
64- * no authority, and the original authority string as its path after properly escaped.
65- * We recommend libraries to specify the schema explicitly if it is known, since libraries cannot
66- * know which NameResolver will be default during runtime.
62+ * <p>An authority string will be converted to a URI having the scheme of the name resolver with
63+ * the highest priority (e.g. {@code "dns"}), the empty string as the authority, and 'target' as
64+ * its path. We recommend libraries specify the scheme explicitly if it is known, since libraries
65+ * cannot know which NameResolver will be default at runtime.
6766 * Example authority strings:
6867 * <ul>
6968 * <li>{@code "localhost"}</li>
@@ -75,6 +74,14 @@ public static ManagedChannelBuilder<?> forAddress(String name, int port) {
7574 * <li>{@code "[2001:db8:85a3:8d3:1319:8a2e:370:7348]:443"}</li>
7675 * </ul>
7776 *
77+ * <p>We strongly recommend the URI form of `target` because the alternative is ambiguous. For
78+ * example, the target string `foo:8080` is a valid authority string with host `foo` and port
79+ * `8080` but it is also a valid RFC 3986 URI with scheme `foo` and path `8080`. {@code
80+ * NameResolver}s are discovered dynamically from your classpath using SPI, so it's hard to be
81+ * sure in advance how such a target will be resolved. A {@code NameResolver} for scheme `foo`
82+ * might someday make a host named `foo` unreachable! On the other hand, the 'dns:///foo:8080'
83+ * target will always behave the same.
84+ *
7885 * <p>Note that there is an open JDK bug on {@link java.net.URI} class parsing an ipv6 scope ID:
7986 * bugs.openjdk.org/browse/JDK-8199396. This method is exposed to this bug. If you experience an
8087 * issue, a work-around is to convert the scope ID to its numeric form (e.g. by using
0 commit comments