8191810: jjs should avoid hard coded javadoc base url for shift-tab documentation feature

Reviewed-by: hannesw
This commit is contained in:
Athijegannathan Sundararajan 2017-11-23 15:03:22 +05:30
parent abef0ce5b3
commit 802a8bcaf3

View File

@ -296,10 +296,10 @@ public final class Main extends Shell {
}
}
private static String JAVADOC_BASE = "https://docs.oracle.com/javase/9/docs/api/";
private static String JAVADOC_BASE = "https://docs.oracle.com/javase/%d/docs/api/";
private static void openBrowserForJavadoc(ScriptFunction browse, String relativeUrl) {
try {
final URI uri = new URI(JAVADOC_BASE + relativeUrl);
final URI uri = new URI(String.format(JAVADOC_BASE, Runtime.version().major()) + relativeUrl);
ScriptRuntime.apply(browse, null, uri);
} catch (Exception ignored) {
}