Skip to content

Commit

Permalink
Don't initialize an instance variable to its default value
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 27, 2023
1 parent c94a5b7 commit a12f1ee
Show file tree
Hide file tree
Showing 18 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions src/conf/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ limitations under the License.
<property name="max" value="160"/>
</module>
<module name="TreeWalker">
<module name="ExplicitInitializationCheck" />
<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public static Test suite() {
// Input objects that have identical sets of properties and values.
private BenchBean inBean;
private DynaBean inDyna;
private Map<String, Object> inMap = null; // Map of Objects requiring no conversion
private Map<String, String> inStrs = null; // Map of Strings requiring conversion
private Map<String, Object> inMap; // Map of Objects requiring no conversion
private Map<String, String> inStrs; // Map of Strings requiring conversion

// Output objects that have identical sets of properties.
private BenchBean outBean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static Test suite() {
// Input objects that have identical sets of properties and values.
private BenchBean inBean;
private DynaBean inDyna;
private Map<String, Object> inMap = null;
private Map<String, Object> inMap;

// Output objects that have identical sets of properties.
private BenchBean outBean;
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/org/apache/commons/beanutils2/TestBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void setValue(final String key, final String val) {
/**
* A static variable that is accessed and updated via static methods for MethodUtils testing.
*/
private static int counter = 0;
private static int counter;

/**
* Gets the current value of the counter.
Expand Down Expand Up @@ -151,22 +151,22 @@ public static void incrementCounter(final Number amount) {
/**
* A mapped property with only a getter and setter for a Map.
*/
private Map<String, Object> mapProperty = null;
private Map<String, Object> mapProperty;

/**
* A mapped property that has String keys and Object values.
*/
private HashMap<String, Object> mappedObjects = null;
private HashMap<String, Object> mappedObjects;

/**
* A mapped property that has String keys and String values.
*/
private HashMap<String, String> mappedProperty = null;
private HashMap<String, String> mappedProperty;

/**
* A mapped property that has String keys and int values.
*/
private HashMap<String, Integer> mappedIntProperty = null;
private HashMap<String, Integer> mappedIntProperty;

/**
* A nested reference to another test bean (populated as needed).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static TestSuite suite() {
return new TestSuite(BigDecimalConverterTestCase.class);
}

private Converter<BigDecimal> converter = null;
private Converter<BigDecimal> converter;

public BigDecimalConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static TestSuite suite() {
return new TestSuite(BigIntegerConverterTestCase.class);
}

private Converter<BigInteger> converter = null;
private Converter<BigInteger> converter;

public BigIntegerConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static TestSuite suite() {
return new TestSuite(ByteConverterTestCase.class);
}

private Converter<Byte> converter = null;
private Converter<Byte> converter;

public ByteConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static TestSuite suite() {
return new TestSuite(DoubleConverterTestCase.class);
}

private Converter<Double> converter = null;
private Converter<Double> converter;

public DoubleConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static TestSuite suite() {
return new TestSuite(FloatConverterTestCase.class);
}

private Converter<Float> converter = null;
private Converter<Float> converter;

public FloatConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static TestSuite suite() {
return new TestSuite(LongConverterTestCase.class);
}

private Converter<Long> converter = null;
private Converter<Long> converter;

public LongConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static TestSuite suite() {
return new TestSuite(OffsetTimeConverterTestCase.class);
}

private Converter<OffsetTime> converter = null;
private Converter<OffsetTime> converter;

public OffsetTimeConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static TestSuite suite() {
return new TestSuite(PathConverterTestCase.class);
}

private Converter<Path> converter = null;
private Converter<Path> converter;

public PathConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static TestSuite suite() {
return new TestSuite(PeriodConverterTestCase.class);
}

private Converter<Period> converter = null;
private Converter<Period> converter;

public PeriodConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static TestSuite suite() {
return new TestSuite(URIConverterTestCase.class);
}

private Converter<URI> converter = null;
private Converter<URI> converter;

public URIConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static TestSuite suite() {
return new TestSuite(UUIDConverterTestCase.class);
}

private Converter<UUID> converter = null;
private Converter<UUID> converter;

public UUIDConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static TestSuite suite() {
return new TestSuite(YearConverterTestCase.class);
}

private Converter<Year> converter = null;
private Converter<Year> converter;

public YearConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static TestSuite suite() {
return new TestSuite(ZoneOffsetConverterTestCase.class);
}

private Converter<ZoneOffset> converter = null;
private Converter<ZoneOffset> converter;

public ZoneOffsetConverterTestCase(final String name) {
super(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
*/
public class SomeMappedPojo {

private HashMap<String, String> mappedProperty = null;
private HashMap<String, String> mappedProperty;

public String getMappedProperty(final String key) {
// Create the map the very first time
Expand Down

0 comments on commit a12f1ee

Please sign in to comment.