PatternRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!PatternRules\$).*as compiler argument.
Table of contents
PatternAsPredicate
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PatternAsPredicate")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!PatternRules\$PatternAsPredicate).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Predicate<?> testPatternAsPredicate() {
- return Predicates.contains(Pattern.compile("foo"));
+ return Pattern.compile("foo").asPredicate();
}PatternCompileAsPredicate
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("PatternCompileAsPredicate")to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!PatternRules\$PatternCompileAsPredicate).*as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
Predicate<?> testPatternCompileAsPredicate() {
- return Predicates.containsPattern("foo");
+ return Pattern.compile("foo").asPredicate();
}