BigDecimalRules
SUGGESTION
Simplification
Suppression
Disable all rules by adding
-XepOpt:Refaster:NamePattern=^(?!BigDecimalRules\$).*
as compiler argument.
Table of contents
BigDecimalZero
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("BigDecimalZero")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BigDecimalRules\$BigDecimalZero).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<BigDecimal> testBigDecimalZero() {
- return ImmutableSet.of(BigDecimal.valueOf(0), BigDecimal.valueOf(0L), new BigDecimal("0"));
+ return ImmutableSet.of(BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO);
}
BigDecimalOne
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("BigDecimalOne")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BigDecimalRules\$BigDecimalOne).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<BigDecimal> testBigDecimalOne() {
- return ImmutableSet.of(BigDecimal.valueOf(1), BigDecimal.valueOf(1L), new BigDecimal("1"));
+ return ImmutableSet.of(BigDecimal.ONE, BigDecimal.ONE, BigDecimal.ONE);
}
BigDecimalTen
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("BigDecimalTen")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BigDecimalRules\$BigDecimalTen).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<BigDecimal> testBigDecimalTen() {
- return ImmutableSet.of(BigDecimal.valueOf(10), BigDecimal.valueOf(10L), new BigDecimal("10"));
+ return ImmutableSet.of(BigDecimal.TEN, BigDecimal.TEN, BigDecimal.TEN);
}
BigDecimalValueOf
SUGGESTION
Simplification
Suppression
Suppress false positives by adding the suppression annotation
@SuppressWarnings("BigDecimalValueOf")
to the enclosing element.Disable this rule by adding
-XepOpt:Refaster:NamePattern=^(?!BigDecimalRules\$BigDecimalValueOf).*
as compiler argument.
Samples
Shows the difference in example code before and after the Refaster rule is applied.
ImmutableSet<BigDecimal> testBigDecimalValueOf() {
- return ImmutableSet.of(new BigDecimal(2), new BigDecimal(2L), new BigDecimal(2.0));
+ return ImmutableSet.of(BigDecimal.valueOf(2), BigDecimal.valueOf(2L), BigDecimal.valueOf(2.0));
}