Instances start in an uninitialized/empty state. They transition to the initialized state once they start
being populated from the flags and arguments provided to the compiler, or manually via initialize.
Because Options singletons are used to configure many other compiler singletons, depending on how
the compiler is invoked, it's possible for some of these singletons to query options before they have been
populated. If this happens, null/false is returned, and then if/when listeners are notified (indicating that
the population process is complete), if it turns out that the actual option value is different from what was
previously returned, then an assertion error is generated (as this would indicate a startup ordering bug).
To fix, change the initialization order or have the singleton initialize itself using whenReady.
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.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private List | |
| public static final Context. | optionsKey
The context key for the options. |
| private static final long | |
| private final LinkedHashMap |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| private <T> T | computeIfReady(Supplier<T> ifReady, T ifNotReady, String flag)
Return the computed value if initialized, otherwise return the given default value and add a notify listener that asserts that our assumption was correct. |
| public String | |
| public String | |
| public boolean | getBoolean(String
option name name)Get the boolean value for an undocumented option, patterned after Boolean.getBoolean, essentially will return true, iff the value exists and is set to "true". |
| public boolean | getBoolean(String
option name name, boolean return value if option is not set defaultValue)Get the undocumented boolean with a default value if the option is not set. |
| public EnumSet | Returns: the specified set of categoriesthe plain (non-custom) version of the option (e.g., option, Supplier<? extends EnumSet<Lint.Option#XLINT)populates the default set, or null for an empty default set defaults)Collect the set of |
| public void | |
| public static Options | |
| public boolean | isDisabled(Option
the plain (non-custom) version of the option (e.g., option, Lint.Option#XLINT)the lcLintCategory in questionDetermine if a specific |
| public boolean | isEnabled(Option
the plain (non-custom) version of the option (e.g., option, Lint.Option#XLINT)the lcLintCategory in questionDetermine if a specific |
| public boolean | Returns: true iflc is explicitly disabled via option's lint custom variant (e.g., Option#XLINT_CUSTOM)the plain (non-custom) version of the option (e.g., option, Lint.Option#XLINT)the lcLintCategory in questionDetermine if a specific |
| public boolean | Returns: true iflc is explicitly enabled via option's lint custom variant (e.g., Option#XLINT_CUSTOM)the plain (non-custom) version of the option (e.g., option, Lint.Option#XLINT)the lcLintCategory in questionDetermine if a specific |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public Set | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public int | |
| public void |
| initialized | back to summary |
|---|---|
| private boolean initialized | |
| listeners | back to summary |
|---|---|
| private List<Runnable> listeners | |
| optionsKey | back to summary |
|---|---|
| public static final Context. The context key for the options. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| values | back to summary |
|---|---|
| private final LinkedHashMap<String, String> values | |
| Options | back to summary |
|---|---|
protected Options(Context context)
| |
| addListener | back to summary |
|---|---|
| public void addListener(Runnable listener) | |
| clear | back to summary |
|---|---|
| public void clear() | |
| computeIfReady | back to summary |
|---|---|
| private <T> T computeIfReady(Supplier<T> ifReady, T ifNotReady, String flag) Return the computed value if initialized, otherwise return the given default value and add a notify listener that asserts that our assumption was correct. | |
| get | back to summary |
|---|---|
| public String get(String name) Get the value for an undocumented option.
| |
| get | back to summary |
|---|---|
| public String get(Option option) Get the value for an option.
| |
| getBoolean | back to summary |
|---|---|
| public boolean getBoolean(String name) Get the boolean value for an undocumented option, patterned after Boolean.getBoolean, essentially will return true, iff the value exists and is set to "true".
| |
| getBoolean | back to summary |
|---|---|
| public boolean getBoolean(String name, boolean defaultValue) Get the undocumented boolean with a default value if the option is not set.
| |
| getLintCategoriesOf | back to summary |
|---|---|
| public EnumSet Collect the set of
The given The set of categories is calculated as follows. First, an initial set is created:
key:
keys are ignored.
| |
| initialize | back to summary |
|---|---|
| public void initialize() Mark this instance as ready to accept queries. | |
| instance | back to summary |
|---|---|
| public static Options instance(Context context) Get the Options instance for this context. | |
| isDisabled | back to summary |
|---|---|
| public boolean isDisabled(Option option, Lint. Determine if a specific
The given Note It's possible the category was also enabled; this method does not check that.
| |
| isEnabled | back to summary |
|---|---|
| public boolean isEnabled(Option option, Lint. Determine if a specific
The given Note It's possible the category was also disabled; this method does not check that.
| |
| isExplicitlyDisabled | back to summary |
|---|---|
| public boolean isExplicitlyDisabled(Option option, Lint. Determine if a specific
The given Note This does not check for an option flag of the form Note It's possible the category was also enabled; this method does not check that.
| |
| isExplicitlyEnabled | back to summary |
|---|---|
| public boolean isExplicitlyEnabled(Option option, Lint. Determine if a specific
The given Note This does not check for option flags of the form Note It's possible the category was also disabled; this method does not check that.
| |
| isSet | back to summary |
|---|---|
| public boolean isSet(String name) Check if the value for an undocumented option has been set. | |
| isSet | back to summary |
|---|---|
| public boolean isSet(Option option) Check if the value for an option has been set. | |
| isSet | back to summary |
|---|---|
| public boolean isSet(Option option, String value) Check if the value for a choice option has been set to a specific value. | |
| isUnset | back to summary |
|---|---|
| public boolean isUnset(String name) Check if the value for an undocumented option has not been set. | |
| isUnset | back to summary |
|---|---|
| public boolean isUnset(Option option) Check if the value for an option has not been set. | |
| isUnset | back to summary |
|---|---|
| public boolean isUnset(Option option, String value) Check if the value for a choice option has not been set to a specific value. | |
| keySet | back to summary |
|---|---|
| public Set | |
| notifyListeners | back to summary |
|---|---|
| public void notifyListeners() | |
| put | back to summary |
|---|---|
| public void put(String name, String value) | |
| put | back to summary |
|---|---|
| public void put(Option option, String value) | |
| putAll | back to summary |
|---|---|
| public void putAll(Options options) | |
| remove | back to summary |
|---|---|
| public void remove(String name) | |
| size | back to summary |
|---|---|
| public int size() | |
| whenReady | back to summary |
|---|---|
| public void whenReady(Consumer<? super Options> action) Perform the given action once this instance is ready for queries, or immediately if it is ready now. | |