--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Thu Apr 14 09:34:00 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Thu Apr 14 14:30:48 2016 -0700
@@ -52,6 +52,8 @@
import com.sun.tools.javac.file.BaseFileManager;
import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.main.CommandLine;
+import com.sun.tools.javac.main.OptionHelper;
+import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
import com.sun.tools.javac.platform.PlatformDescription;
import com.sun.tools.javac.platform.PlatformUtils;
import com.sun.tools.javac.util.ClientCodeException;
@@ -342,7 +344,7 @@
compOpts = Options.instance(context);
// Make sure no obsolete source/target messages are reported
- compOpts.put("-Xlint:-options", "-Xlint:-options");
+ com.sun.tools.javac.main.Option.XLINT.process(getOptionHelper(), "-Xlint:-options");
doclet.init(locale, messager);
parseArgs(argList, javaNames);
@@ -550,6 +552,8 @@
if (o.hasArg) {
oneArg(args, i++);
o.process(this, args.get(i));
+ } else if (o.hasSuffix) {
+ o.process(this, arg);
} else {
setOption(arg);
o.process(this);
@@ -690,4 +694,19 @@
}
return null;
}
+
+ @Override
+ OptionHelper getOptionHelper() {
+ return new GrumpyHelper(null) {
+ @Override
+ public String get(com.sun.tools.javac.main.Option option) {
+ return compOpts.get(option);
+ }
+
+ @Override
+ public void put(String name, String value) {
+ compOpts.put(name, value);
+ }
+ };
+ }
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java Thu Apr 14 09:34:00 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolOption.java Thu Apr 14 14:30:48 2016 -0700
@@ -32,6 +32,7 @@
import java.util.StringTokenizer;
import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.main.OptionHelper;
import com.sun.tools.javac.util.Options;
/**
@@ -118,14 +119,14 @@
ADDMODS("-addmods", true) {
@Override
public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
+ Option.ADDMODS.process(helper.getOptionHelper(), opt, arg);
}
},
LIMITMODS("-limitmods", true) {
@Override
public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
+ Option.LIMITMODS.process(helper.getOptionHelper(), opt, arg);
}
},
@@ -133,35 +134,63 @@
@Override
public void process(Helper helper, String arg) {
helper.encoding = arg;
- helper.setCompilerOpt(opt, arg);
+ helper.setFileManagerOpt(Option.ENCODING, arg);
}
},
RELEASE("-release", true) {
@Override
public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
+ Option.RELEASE.process(helper.getOptionHelper(), opt, arg);
}
},
SOURCE("-source", true) {
@Override
public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
+ Option.SOURCE.process(helper.getOptionHelper(), opt, arg);
}
},
XMAXERRS("-Xmaxerrs", true) {
@Override
public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
+ Option.XMAXERRS.process(helper.getOptionHelper(), opt, arg);
}
},
XMAXWARNS("-Xmaxwarns", true) {
@Override
public void process(Helper helper, String arg) {
- helper.setCompilerOpt(opt, arg);
+ Option.XMAXWARNS.process(helper.getOptionHelper(), opt, arg);
+ }
+ },
+
+ XADDREADS("-XaddReads:", false) {
+ @Override
+ public void process(Helper helper, String arg) {
+ Option.XADDREADS.process(helper.getOptionHelper(), arg);
+ }
+ },
+
+ XADDEXPORTS("-XaddExports:", false) {
+ @Override
+ public void process(Helper helper, String arg) {
+ Option.XADDEXPORTS.process(helper.getOptionHelper(), arg);
+ }
+ },
+
+ XMODULE("-Xmodule:", false) {
+ @Override
+ public void process(Helper helper, String arg) {
+ Option.XMODULE.process(helper.getOptionHelper(), arg);
+ }
+ },
+
+ XPATCH("-Xpatch:", false) {
+ @Override
+ public void process(Helper helper, String arg) {
+ Option.XMODULE.process(helper.getOptionHelper(), arg);
}
},
@@ -299,6 +328,7 @@
public final String opt;
public final boolean hasArg;
+ public final boolean hasSuffix; // ex: foo:bar or -foo=bar
ToolOption(String opt) {
this(opt, false);
@@ -307,6 +337,8 @@
ToolOption(String opt, boolean hasArg) {
this.opt = opt;
this.hasArg = hasArg;
+ char lastChar = opt.charAt(opt.length() - 1);
+ this.hasSuffix = lastChar == ':' || lastChar == '=';
}
void process(Helper helper, String arg) { }
@@ -314,9 +346,16 @@
void process(Helper helper) { }
static ToolOption get(String name) {
- for (ToolOption o: values()) {
- if (name.equals(o.opt))
+ String oname = name;
+ if (name.contains(":")) {
+ oname = name.substring(0, name.indexOf(':') + 1);
+ } else if (name.contains("=")) {
+ oname = name.substring(0, name.indexOf('=') + 1);
+ }
+ for (ToolOption o : values()) {
+ if (oname.equals(o.opt)) {
return o;
+ }
}
return null;
}
@@ -366,6 +405,7 @@
abstract void Xusage();
abstract void usageError(String msg, Object... args);
+ abstract OptionHelper getOptionHelper();
void addToList(List<String> list, String str){
StringTokenizer st = new StringTokenizer(str, ":");
@@ -388,13 +428,6 @@
}
}
- void setCompilerOpt(String opt, String arg) {
- if (compOpts.get(opt) != null) {
- usageError("main.option.already.seen", opt);
- }
- compOpts.put(opt, arg);
- }
-
void setFileManagerOpt(Option opt, String arg) {
fileManagerOpts.put(opt, arg);
}
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties Thu Apr 14 09:34:00 2016 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc.properties Thu Apr 14 14:30:48 2016 -0700
@@ -37,6 +37,13 @@
\ -help Display command line options and exit\n\
\ -doclet <class> Generate output via alternate doclet\n\
\ -docletpath <path> Specify where to find doclet class files\n\
+\ -modulesourcepath <path> Specify where to find input source files for multiple modules\n\
+\ -upgrademodulepath <path> Override location of upgradeable modules\n\
+\ -modulepath <path> Specify where to find application modules\n\
+\ -mp <path> Specify where to find application modules\n\
+\ -addmods <module>(,<module>)* Root modules to resolve in addition to the initial modules,\n\
+\ or all modules on the module path if <module> is ALL-MODULE-PATH.\n\
+\ -limitmods <module>(,<module>)* Limit the universe of observable modules\n\
\ -sourcepath <pathlist> Specify where to find source files\n\
\ -classpath <pathlist> Specify where to find user class files\n\
\ -cp <pathlist> Specify where to find user class files\n\
@@ -56,14 +63,23 @@
main.Xusage=\
\ -Xmaxerrs <number> Set the maximum number of errors to print\n\
-\ -Xmaxwarns <number> Set the maximum number of warnings to print\n
+\ -Xmaxwarns <number> Set the maximum number of warnings to print\n\
+\ -XaddExports:<module>/<package>=<other-module>(,<other-module>)*\n\
+\ Specify a package to be considered as exported from its \n\
+\ defining module to additional modules, or to all unnamed \n\
+\ modules if <other-module> is ALL-UNNAMED.\n\
+\ -XaddReads:<module>=<other-module>(,<other-module>)*\n\
+\ Specify additional modules to be considered as required by a\n\
+\ given module. <other-module> may be ALL-UNNAMED to require\n\
+\ the unnamed module.\n\
+\ -Xmodule:<module-name> Specify a module to which the classes being compiled belong.\n\
+\ -Xpatch:<path> Specify location of module class files to patch\n
main.Xusage.foot=\
These options are non-standard and subject to change without notice.
main.doclet.usage.header=Provided by the {0} doclet:
-main.option.already.seen=The {0} option may be specified no more than once.
main.requires_argument=option {0} requires an argument.
main.invalid_flag=invalid flag: {0}
main.No_packages_or_classes_specified=No packages or classes specified.