--- old/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java 2018-07-11 10:50:43.216000000 -0700 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java 2018-07-11 10:50:43.056000000 -0700 @@ -131,6 +131,10 @@ return tab.get(name); } + public boolean isSupported() { + return this.compareTo(MIN) >= 0; + } + public Target requiredTarget() { if (this.compareTo(JDK12) >= 0) return Target.JDK1_12; if (this.compareTo(JDK11) >= 0) return Target.JDK1_11; --- old/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java 2018-07-11 10:50:43.624000000 -0700 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Target.java 2018-07-11 10:50:43.480000000 -0700 @@ -49,22 +49,22 @@ JDK1_4("1.4", 48, 0), /** JDK 5, codename Tiger. */ - JDK1_5("1.5", 49, 0), + JDK1_5("5", 49, 0), /** JDK 6. */ - JDK1_6("1.6", 50, 0), + JDK1_6("6", 50, 0), /** JDK 7. */ - JDK1_7("1.7", 51, 0), + JDK1_7("7", 51, 0), /** JDK 8. */ - JDK1_8("1.8", 52, 0), + JDK1_8("8", 52, 0), /** JDK 9. */ - JDK1_9("1.9", 53, 0), + JDK1_9("9", 53, 0), /** JDK 10. */ - JDK1_10("1.10", 54, 0), + JDK1_10("10", 54, 0), /** JDK 11. */ JDK1_11("11", 55, 0), @@ -95,14 +95,12 @@ for (Target t : values()) { tab.put(t.name, t); } - tab.put("5", JDK1_5); - tab.put("6", JDK1_6); - tab.put("7", JDK1_7); - tab.put("8", JDK1_8); - tab.put("9", JDK1_9); - tab.put("10", JDK1_10); - tab.put("11", JDK1_11); - tab.put("12", JDK1_12); + tab.put("1.5", JDK1_5); + tab.put("1.6", JDK1_6); + tab.put("1.7", JDK1_7); + tab.put("1.8", JDK1_8); + tab.put("1.9", JDK1_9); + tab.put("1.10", JDK1_10); } public final String name; @@ -120,6 +118,10 @@ return tab.get(name); } + public boolean isSupported() { + return this.compareTo(MIN) >= 0; + } + /** Return the character to be used in constructing synthetic * identifiers, where not specified by the JLS. */ --- old/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java 2018-07-11 10:50:44.024000000 -0700 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java 2018-07-11 10:50:43.884000000 -0700 @@ -41,6 +41,7 @@ import java.util.Locale; import java.util.ServiceLoader; import java.util.Set; +import java.util.StringJoiner; import java.util.TreeSet; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -295,6 +296,16 @@ } super.process(helper, option, operand); } + + @Override + protected void help(Log log) { + StringJoiner sj = new StringJoiner(", "); + for(Source source : Source.values()) { + if (source.isSupported()) + sj.add(source.name); + } + super.help(log, log.localize(PrefixKind.JAVAC, descrKey, sj.toString())); + } }, TARGET("-target", "opt.arg.release", "opt.target", STANDARD, BASIC) { @@ -306,6 +317,16 @@ } super.process(helper, option, operand); } + + @Override + protected void help(Log log) { + StringJoiner sj = new StringJoiner(", "); + for(Target target : Target.values()) { + if (target.isSupported()) + sj.add(target.name); + } + super.help(log, log.localize(PrefixKind.JAVAC, descrKey, sj.toString())); + } }, RELEASE("--release", "opt.arg.release", "opt.release", STANDARD, BASIC) { --- old/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties 2018-07-11 10:50:44.456000000 -0700 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac.properties 2018-07-11 10:50:44.296000000 -0700 @@ -80,11 +80,11 @@ javac.opt.profile=\ Check that API used is available in the specified profile javac.opt.target=\ - Generate class files for specific VM version + Generate class files for specific VM version. Supported versions: {0} javac.opt.release=\ - Compile for a specific VM version. Supported targets: {0} + Compile for a specific release. Supported releases: {0} javac.opt.source=\ - Provide source compatibility with specified release + Provide source compatibility with specified release. Supported releases: {0} javac.opt.Werror=\ Terminate compilation if warnings occur javac.opt.A=\ --- old/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java 2018-07-11 10:50:44.848000000 -0700 +++ new/test/langtools/jdk/javadoc/tool/modules/ReleaseOptions.java 2018-07-11 10:50:44.700000000 -0700 @@ -58,7 +58,7 @@ Task.Result result = execNegativeTask("--release", "8", "--patch-module", "m=" + mpath.toString(), "p"); - assertMessagePresent(".*not allowed with target 1.8.*"); + assertMessagePresent(".*not allowed with target 8.*"); assertMessageNotPresent(".*Exception*"); assertMessageNotPresent(".java.lang.AssertionError.*"); } @@ -92,7 +92,7 @@ Task.Result result = execNegativeTask("--release", "8", "--module-source-path", src.toString(), "--module", "m"); - assertMessagePresent(".*not allowed with target 1.8.*"); + assertMessagePresent(".*not allowed with target 8.*"); assertMessageNotPresent(".*Exception*"); assertMessageNotPresent(".java.lang.AssertionError.*"); } --- old/test/langtools/tools/javac/modules/AddLimitMods.java 2018-07-11 10:50:45.248000000 -0700 +++ new/test/langtools/tools/javac/modules/AddLimitMods.java 2018-07-11 10:50:45.096000000 -0700 @@ -264,7 +264,7 @@ .writeAll() .getOutputLines(Task.OutputKind.DIRECT); - if (!actual.contains("- compiler.err.option.not.allowed.with.target: --add-modules, 1.8")) { + if (!actual.contains("- compiler.err.option.not.allowed.with.target: --add-modules, 8")) { throw new IllegalStateException("incorrect errors; actual=" + actual); }