< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/main/Option.java

Print this page
rev 2977 : JDK-8058150

*** 30,56 **** --- 30,61 ---- import java.io.PrintWriter; import java.util.Collections; import java.util.EnumSet; import java.util.LinkedHashMap; import java.util.Map; + import java.util.ServiceLoader; import java.util.Set; + import java.util.TreeSet; import javax.lang.model.SourceVersion; import com.sun.tools.doclint.DocLint; import com.sun.tools.javac.code.Lint; import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Source; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.jvm.Profile; import com.sun.tools.javac.jvm.Target; + import com.sun.tools.javac.platform.PlatformProvider; + import com.sun.tools.javac.platform.PlatformProviderFactory; import com.sun.tools.javac.processing.JavacProcessingEnvironment; import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Log.PrefixKind; import com.sun.tools.javac.util.Log.WriterKind; import com.sun.tools.javac.util.Options; import com.sun.tools.javac.util.StringUtils; + import static com.sun.tools.javac.main.Option.ChoiceKind.*; import static com.sun.tools.javac.main.Option.OptionGroup.*; import static com.sun.tools.javac.main.Option.OptionKind.*; /**
*** 262,271 **** --- 267,307 ---- } return super.process(helper, option, operand); } }, + PLATFORM("-platform", "opt.arg.platform", "opt.platform", STANDARD, BASIC) { + @Override + void help(Log log, OptionKind kind) { + if (this.kind != kind) + return; + + Iterable<PlatformProviderFactory> factories = + ServiceLoader.load(PlatformProviderFactory.class, Arguments.class.getClassLoader()); + Set<String> platforms = new TreeSet<>(); + + for (PlatformProviderFactory factory : factories) { + for (PlatformProvider platform : factory.createPlatformProviders()) { + platforms.add(platform.getName()); + } + } + + StringBuilder targets = new StringBuilder(); + String delim = ""; + for (String platform : platforms) { + targets.append(delim); + targets.append(platform); + delim = ", "; + } + + log.printRawLines(WriterKind.NOTICE, + String.format(HELP_LINE_FORMAT, + super.helpSynopsis(log), + log.localize(PrefixKind.JAVAC, descrKey, targets.toString()))); + } + }, + PROFILE("-profile", "opt.arg.profile", "opt.profile", STANDARD, BASIC) { @Override public boolean process(OptionHelper helper, String option, String operand) { Profile profile = Profile.lookup(operand); if (profile == null) {
< prev index next >