mirror of
https://github.com/openjdk/jdk.git
synced 2026-08-03 22:55:40 +00:00
Merge branch 'JDK-8359596' into JDK-8348611
This commit is contained in:
commit
34ab5edecf
@ -170,8 +170,8 @@ public class Log extends AbstractLog {
|
||||
boolean emit = !diag.isFlagSet(DEFAULT_ENABLED) ? // is the warning not enabled by default?
|
||||
lint.isEnabled(category) : // then emit if the category is enabled
|
||||
category.annotationSuppression ? // else emit if the category is not suppressed, where
|
||||
!lint.isSuppressed(category) : // ...suppression happens via @SuppressWarnings
|
||||
!options.isExplicitlyDisabled(Option.XLINT, category); // ...suppression happens via -Xlint:-category
|
||||
!lint.isSuppressed(category) : // ...suppression happens via @SuppressWarnings
|
||||
!options.isDisabled(Option.XLINT, category); // ...suppression happens via -Xlint:-category
|
||||
if (!emit)
|
||||
return;
|
||||
}
|
||||
|
||||
@ -171,12 +171,46 @@ public class Options {
|
||||
return !isSet(option, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a specific {@link LintCategory} is enabled via a custom
|
||||
* option flag of the form {@code -Flag}, {@code -Flag:all}, or {@code -Flag:key}.
|
||||
*
|
||||
* <p>
|
||||
* Note: It's possible the category was also disabled; this method does not check that.
|
||||
*
|
||||
* @param option the plain (non-custom) version of the option (e.g., {@link Option#XLINT})
|
||||
* @param lc the {@link LintCategory} in question
|
||||
* @return true if {@code lc} has been enabled
|
||||
*/
|
||||
public boolean isEnabled(Option option, LintCategory lc) {
|
||||
Option custom = option.getCustom();
|
||||
return isExplicitlyEnabled(option, lc) || isSet(custom) || isSet(custom, Option.LINT_CUSTOM_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a specific {@link LintCategory} is disabled via a custom
|
||||
* option flag of the form {@code -Flag:none} or {@code -Flag:-key}.
|
||||
*
|
||||
* <p>
|
||||
* Note: It's possible the category was also enabled; this method does not check that.
|
||||
*
|
||||
* @param option the plain (non-custom) version of the option (e.g., {@link Option#XLINT})
|
||||
* @param lc the {@link LintCategory} in question
|
||||
* @return true if {@code lc} has been disabled
|
||||
*/
|
||||
public boolean isDisabled(Option option, LintCategory lc) {
|
||||
return isExplicitlyDisabled(option, lc) || isSet(option.getCustom(), Option.LINT_CUSTOM_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a specific {@link LintCategory} is explicitly enabled via a custom
|
||||
* option flag of the form {@code -Flag:key}.
|
||||
*
|
||||
* <p>
|
||||
* Note: It's possible the category was also explicitly disabled; this method does not check that.
|
||||
* Note: This does not check for option flags of the form {@code -Flag} or {@code -Flag:all}.
|
||||
*
|
||||
* <p>
|
||||
* Note: It's possible the category was also disabled; this method does not check that.
|
||||
*
|
||||
* @param option the plain (non-custom) version of the option (e.g., {@link Option#XLINT})
|
||||
* @param lc the {@link LintCategory} in question
|
||||
@ -192,7 +226,10 @@ public class Options {
|
||||
* option flag of the form {@code -Flag:-key}.
|
||||
*
|
||||
* <p>
|
||||
* Note: It's possible the category was also explicitly enabled; this method does not check that.
|
||||
* Note: This does not check for an option flag of the form {@code -Flag:none}.
|
||||
*
|
||||
* <p>
|
||||
* Note: It's possible the category was also enabled; this method does not check that.
|
||||
*
|
||||
* @param option the plain (non-custom) version of the option (e.g., {@link Option#XLINT})
|
||||
* @param lc the {@link LintCategory} in question
|
||||
|
||||
@ -31,6 +31,8 @@
|
||||
* @compile/fail/ref=LintOptions.out -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:options LintOptions.java
|
||||
* @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:-options LintOptions.java
|
||||
* @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:options -Xlint:-options LintOptions.java
|
||||
* @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:none LintOptions.java
|
||||
* @compile -Werror -XDrawDiagnostics -source 21 -target 21 -Xlint:options -Xlint:none LintOptions.java
|
||||
*/
|
||||
class LintOptions {
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user