--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Fri Mar 24 06:40:28 2017 -0700
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/Start.java Mon Mar 27 17:53:00 2017 -0700
@@ -513,12 +513,22 @@
} catch (com.sun.tools.javac.main.Option.InvalidValueException ignore) {
}
+ Arguments arguments = Arguments.instance(context);
+ arguments.init(ProgramName);
+ arguments.allowEmpty();
+
doclet.init(locale, messager);
parseArgs(argList, javaNames);
- Arguments arguments = Arguments.instance(context);
- arguments.init(ProgramName);
- arguments.allowEmpty();
+ if (!arguments.handleReleaseOptions(extra -> true)) {
+ // Arguments does not always increase the error count in the
+ // case of errors, so increment the error count only if it has
+ // not been updated previously, preventing complaints by callers
+ if (!messager.hasErrors() && !messager.hasWarnings())
+ messager.nerrors++;
+ return CMDERR;
+ }
+
if (!arguments.validate()) {
// Arguments does not always increase the error count in the
// case of errors, so increment the error count only if it has
@@ -532,49 +542,6 @@
((BaseFileManager) fileManager).handleOptions(fileManagerOpts);
}
- String platformString = compOpts.get("--release");
-
- if (platformString != null) {
- if (compOpts.isSet("-source")) {
- String text = messager.getText("main.release.bootclasspath.conflict", "-source");
- throw new ToolException(CMDERR, text);
- }
- if (fileManagerOpts.containsKey(BOOT_CLASS_PATH)) {
- String text = messager.getText("main.release.bootclasspath.conflict",
- BOOT_CLASS_PATH.getPrimaryName());
- throw new ToolException(CMDERR, text);
- }
-
- PlatformDescription platformDescription =
- PlatformUtils.lookupPlatformDescription(platformString);
-
- if (platformDescription == null) {
- String text = messager.getText("main.unsupported.release.version", platformString);
- throw new IllegalArgumentException(text);
- }
-
- compOpts.put(SOURCE, platformDescription.getSourceVersion());
-
- context.put(PlatformDescription.class, platformDescription);
-
- Collection<Path> platformCP = platformDescription.getPlatformPath();
-
- if (platformCP != null) {
- if (fileManager instanceof StandardJavaFileManager) {
- StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
- try {
- sfm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, platformCP);
- } catch (IOException ioe) {
- throw new ToolException(SYSERR, ioe.getMessage(), ioe);
- }
- } else {
- String text = messager.getText("main.release.not.standard.file.manager",
- platformString);
- throw new ToolException(ABNORMAL, text);
- }
- }
- }
-
compOpts.notifyListeners();
List<String> modules = (List<String>) jdtoolOpts.computeIfAbsent(ToolOption.MODULE,
s -> Collections.EMPTY_LIST);