8166379: IAE while invoking javadoc with --patch-module
authorksrini
Tue, 08 Nov 2016 12:56:17 -0800
changeset 41990 ffaf4e59538a
parent 41945 31f5023200d4
child 41991 cc8a2784dd4c
8166379: IAE while invoking javadoc with --patch-module Reviewed-by: jjg
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java
langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java
langtools/test/jdk/javadoc/tool/modules/Modules.java
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Wed Jul 05 22:26:06 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java	Tue Nov 08 12:56:17 2016 -0800
@@ -939,6 +939,17 @@
             public void put(String name, String value) {
                 compOpts.put(name, value);
             }
+
+            @Override
+            public void remove(String name) {
+                compOpts.remove(name);
+            }
+
+            @Override
+            public boolean handleFileManagerOption(com.sun.tools.javac.main.Option option, String value) {
+                fileManagerOpts.put(option, value);
+                return true;
+            }
         };
     }
 
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Wed Jul 05 22:26:06 2017 +0200
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java	Tue Nov 08 12:56:17 2016 -0800
@@ -57,63 +57,56 @@
     BOOTCLASSPATH("-bootclasspath", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
+            Option.BOOT_CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     CLASS_PATH("--class-path -classpath -cp", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.CLASS_PATH, arg);
+            Option.CLASS_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     EXTDIRS("-extdirs", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.EXTDIRS, arg);
+            Option.EXTDIRS.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     SOURCE_PATH("--source-path -sourcepath", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SOURCE_PATH, arg);
-        }
-    },
-
-    SYSCLASSPATH("-sysclasspath", HIDDEN, true) {
-        @Override
-        public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.BOOT_CLASS_PATH, arg);
+            Option.SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     MODULE_SOURCE_PATH("--module-source-path", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_SOURCE_PATH, arg);
+            Option.MODULE_SOURCE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     UPGRADE_MODULE_PATH("--upgrade-module-path", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.UPGRADE_MODULE_PATH, arg);
+            Option.UPGRADE_MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     SYSTEM("--system", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.SYSTEM, arg);
+            Option.SYSTEM.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
     MODULE_PATH("--module-path -p", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.MODULE_PATH, arg);
+            Option.MODULE_PATH.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
@@ -141,7 +134,7 @@
     ENCODING("-encoding", STANDARD, true) {
         @Override
         public void process(Helper helper, String arg) {
-            helper.setFileManagerOpt(Option.ENCODING, arg);
+            Option.ENCODING.process(helper.getOptionHelper(), primaryName, arg);
         }
     },
 
@@ -290,14 +283,6 @@
 
     // ----- output control options -----
 
-    PROMPT("-prompt", HIDDEN) {
-        @Override
-        public void process(Helper helper) {
-            helper.compOpts.put("-prompt", "-prompt");
-            helper.promptOnError = true;
-        }
-    },
-
     QUIET("-quiet", STANDARD) {
         @Override
         public void process(Helper helper) {
--- a/langtools/test/jdk/javadoc/tool/modules/Modules.java	Wed Jul 05 22:26:06 2017 +0200
+++ b/langtools/test/jdk/javadoc/tool/modules/Modules.java	Tue Nov 08 12:56:17 2016 -0800
@@ -296,7 +296,7 @@
         checkMembersSelected("pkg2.B.f");
     }
 
-//    @Test @ignore JDK-8166379
+    @Test
     public void testPatchModuleOption(Path base) throws Exception {
         Path src = base.resolve("src");
         Path modulePath = base.resolve("modules");