8191810: jjs should avoid hard coded javadoc base url for shift-tab documentation feature
Reviewed-by: hannesw
--- a/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Thu Nov 23 13:21:50 2017 +0530
+++ b/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java Thu Nov 23 15:03:22 2017 +0530
@@ -296,10 +296,10 @@
}
}
- 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) {
}