APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.main

public sealed Enum Option

extends Enum<Option>
Class Inheritance
Imports
java.io.FileWriter, .PrintWriter, java.lang.module.ModuleDescriptor, java.nio.file.Files, .InvalidPathException, .Path, .Paths, java.text.Collator, java.util.Collection, .ArrayList, .Arrays, .Collections, .Comparator, .EnumSet, .Iterator, .LinkedHashSet, .List, .Locale, .ServiceLoader, .Set, .StringJoiner, .TreeMap, java.util.regex.Pattern, java.util.stream.Collectors, .Stream, .StreamSupport, javax.lang.model.SourceVersion, jdk.internal.misc.VM, com.sun.tools.doclint.DocLint, com.sun.tools.javac.code.Lint, .Lint.LintCategory, .Source, .Type, com.sun.tools.javac.jvm.Profile, .Target, com.sun.tools.javac.platform.PlatformProvider, com.sun.tools.javac.processing.JavacProcessingEnvironment, com.sun.tools.javac.resources.CompilerProperties.Errors, com.sun.tools.javac.util.Assert, .Log, .Log.PrefixKind, .Log.WriterKind, .Options, .StringUtils

Options for javac. The specific Option to handle a command-line option can be found by calling lookup, which search some or all of the members of this enum in order, looking for the first match. The action for an Option is performed handleOption, which determines whether an argument is needed and where to find it; handleOption then calls process providing a suitable OptionHelper to provide access the compiler state.

A subset of options is relevant to the source launcher implementation located in com.sun.tools.javac.launcher package. When an option is added, changed, or removed, also update the RelevantJavacOptions class in the launcher package accordingly.

Maintenance note: when adding new annotation processing related options, the list of options regarded as requesting explicit annotation processing in JavaCompiler should be updated.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Option.ArgKind

The kind of argument, if any, accepted by this option.

pack-priv static enum
Option.ChoiceKind

The kind of choice for "choice" options.

pack-priv static enum
public static class
Option.InvalidValueException

This exception is thrown when an invalid value is given for an option.

pack-priv static enum
Option.OptionGroup

The group for an Option.

public static enum
Option.OptionKind

The kind of an Option.

public static enum

Field Summary

Modifier and TypeField and Description
public static final Option
A

public static final Option
public static final Option
public static final Option
public static final Option
private final Option.ArgKind
argKind

The kind of argument for this option.

protected final String
argsNameKey

Documentation key for arguments.

public static final Option
public static final Option
private final Option.ChoiceKind
choiceKind

The kind of choices for this option, if any.

private final Set<String>
choices

The choices for this option, if any.

public static final Option
private static final String
COMPACT_FORMAT

The format for a single-line help entry.

public static final Option
D

public static final Option
private static final int
DEFAULT_MAX_LINE_LENGTH

The nominal maximum line length, when seeing if text will fit on a line.

public static final Option
private static final int
DEFAULT_SYNOPSIS_WIDTH

The space allowed for the synopsis, if the description is to be shown on the same line.

public static final Option
protected final String
descrKey

Documentation key for description.

public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
G

public static final Option
public static final Option
private final Option.OptionGroup
group

The group for this option.

public static final Option
H

public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
J

private final Option.OptionKind
kind

The kind of this option.

private static final String
LARGE_INDENT

The automatic indent for the description.

public static final Option
public static final String
LINT_CUSTOM_ALL

Special lint category key meaning "all lint categories".

public static final String
LINT_CUSTOM_NONE

Special lint category key meaning "no lint categories".

public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public final String[]
names

The set of names (primary name and aliases) for this option.

public static final Option
public static final Option
O

public static final Option
public static final Option
public static final Option
public static final Option
public final String
primaryName

The "primary name" for this option.

public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
S

public static final Option
private static final String
SMALL_INDENT

The indent for the option synopsis.

public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
X

public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option
public static final Option

Constructor Summary

AccessConstructor and Description
private
Option(String text, String descrKey, Option.OptionKind kind, Option.OptionGroup group)

private
Option(String text, String descrKey, Option.OptionKind kind, Option.OptionGroup group, Option.ArgKind argKind)

private
Option(String text, String argsNameKey, String descrKey, Option.OptionKind kind, Option.OptionGroup group)

private
Option(String text, String argsNameKey, String descrKey, Option.OptionKind kind, Option.OptionGroup group, Option.ArgKind ak)

private
Option(String text, String argsNameKey, String descrKey, Option.OptionKind kind, Option.OptionGroup group, Option.ChoiceKind choiceKind, Set<String> choices)

private
Option(String text, String descrKey, Option.OptionKind kind, Option.OptionGroup group, Option.ChoiceKind choiceKind, String... choices)

private
Option(String text, String argsNameKey, String descrKey, Option.OptionKind kind, Option.OptionGroup group, Option.ChoiceKind choiceKind, Set<String> choices, Option.ArgKind argKind)

Method Summary

Modifier and TypeMethod and Description
private static int

Returns:

the position of the first':' or '=' character in the word, or -1 if none found
findSeparator
(String
the word to be scanned
word
)

Scans a word to find the first separator character, either colon or equals.

private static String

Returns:

a comma separated representation of the values
formatAbbreviatedList
(Collection<String>
the values to format
values
)

Formats a collection of values as an abbreviated, comma separated list for use in javac help output.

public Option.ArgKind
public Option

Returns:

corresponding custom option
getCustom
()

If this option is named FOO, obtain the option named FOO_CUSTOM.

public static Set<Option>

Returns:

the set of options.
getJavacFileManagerOptions
()

Returns the set of options supported by the built-in file manager.

pack-priv static Set<Option>

Returns:

the set of options.
getJavaCompilerOptions
()

Returns the set of options supported by the command line tool.

public static Set<Option>

Returns:

the set of options.
getJavacToolOptions
()

Returns the set of options supported by this implementation of the JavaCompiler API, via JavaCompiler#getTask.

public Option.OptionKind
public Option

Returns:

corresponding lint custom option
getLintCustom
()

Like getCustom but also requires that the custom option supports lint categories.

private static Set<Option>
public Pattern

Returns:

the pattern
getPattern
()

Returns a pattern to analyze the value for an option.

public String
private static Set<String>
public void
handleOption(OptionHelper
a helper to provide access to the environment
helper
,
String
the arg string that identified this option
arg
,
Iterator<String>
the remaining strings to be analysed
rest
)

Handles an option.

public boolean
public boolean
protected void
help(Log
the log
log
)

Writes help text for this option to the log.

protected void
help(Log log, String descr)

private String

Returns:

the synopsis
helpSynopsis
(String
the name of this form of the option
name
,
Log
the log used to localize the description of the arguments
log
)

Composes the initial synopsis of one of the forms for this option.

public boolean
public static Option

Returns:

the first option that matches, or null if none.
lookup
(String
the argument to be matches
arg
)

Looks up the first option matching the given argument in the full set of options.

public static Option

Returns:

the first option that matches, or null if none.
lookup
(String
the argument to be matched
arg
,
Set<Option>
the set of possible options
options
)

Looks up the first option matching the given argument within a set of options.

public boolean
matches(String option)

private boolean
matches(String option, String name)

public void
process(OptionHelper
a helper to provide access to the environment
helper
,
String
the option to be processed
option
)

Processes an option that either does not need an argument, or which contains an argument within it, following a separator.

public void
process(OptionHelper
a helper to provide access to the environment
helper
,
String
the option to be processed
option
,
String
the value to associate with the option, or a default value to be used if the option does not otherwise take an argument.
arg
)

Processes an option by updating the environment via a helper object.

private static void
showHelp(Log
the log
log
,
Option.OptionKind
the kind of options to select
kind
)

Writes the "command line help" for given kind of option to the log.

public static Option
public static Option[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf