This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/commons-text.git
The following commit(s) were added to refs/heads/release by this push:
new d5e8a73e Don't initialize an instance or static variable to its
default value
d5e8a73e is described below
commit d5e8a73e7b9e06f71a5c66576b428e6c34b3c684
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Oct 27 11:06:11 2023 -0400
Don't initialize an instance or static variable to its default value
---
src/conf/checkstyle.xml | 1 +
src/main/java/org/apache/commons/text/numbers/DoubleFormat.java | 6 +++---
.../java/org/apache/commons/text/numbers/ParsedDecimalTest.java | 4 ++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 5dea6d7d..b98c717e 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -83,6 +83,7 @@
<module name="TreeWalker">
+ <module name="ExplicitInitializationCheck" />
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocType" />
diff --git a/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
b/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
index 6527574c..fb74d61e 100644
--- a/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
+++ b/src/main/java/org/apache/commons/text/numbers/DoubleFormat.java
@@ -363,7 +363,7 @@ public enum DoubleFormat {
private final Function<Builder, DoubleFunction<String>> factory;
/** Maximum number of significant decimal digits in formatted strings.
*/
- private int maxPrecision = 0;
+ private int maxPrecision;
/** Minimum decimal exponent. */
private int minDecimalExponent = Integer.MIN_VALUE;
@@ -396,7 +396,7 @@ public enum DoubleFormat {
private char groupingSeparator = ',';
/** If {@code true}, thousands groups will be separated by the
grouping separator. */
- private boolean groupThousands = false;
+ private boolean groupThousands;
/** Minus sign character. */
private char minusSign = '-';
@@ -405,7 +405,7 @@ public enum DoubleFormat {
private String exponentSeparator = "E";
/** Flag indicating if the exponent value should always be included,
even if zero. */
- private boolean alwaysIncludeExponent = false;
+ private boolean alwaysIncludeExponent;
/**
* Builds a new instance that delegates double function construction
to the given factory object.
diff --git
a/src/test/java/org/apache/commons/text/numbers/ParsedDecimalTest.java
b/src/test/java/org/apache/commons/text/numbers/ParsedDecimalTest.java
index ac68b17a..757e2e1a 100644
--- a/src/test/java/org/apache/commons/text/numbers/ParsedDecimalTest.java
+++ b/src/test/java/org/apache/commons/text/numbers/ParsedDecimalTest.java
@@ -41,13 +41,13 @@ public class ParsedDecimalTest {
private char thousandsGroupingSeparator = ',';
- private boolean groupThousands = false;
+ private boolean groupThousands;
private char minusSign = '-';
private String exponentSeparator = "E";
- private boolean alwaysIncludeExponent = false;
+ private boolean alwaysIncludeExponent;
@Override
public char getDecimalSeparator() {