8191810: jjs should avoid hard coded javadoc base url for shift-tab documentation feature
authorsundar
Thu, 23 Nov 2017 15:03:22 +0530
changeset 47927 a6b2d28c8094
parent 47926 c5ad58d25a0d
child 47928 fb62d4519338
8191810: jjs should avoid hard coded javadoc base url for shift-tab documentation feature Reviewed-by: hannesw
src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java
--- 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) {
         }