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 b999022 commit c94a5b7
Show file tree
Hide file tree
Showing 20 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static Test suite() {
/**
* The basic test bean for each test.
*/
protected DynaBean bean = null;
protected DynaBean bean;

/**
* Constructs a new instance of this test case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public static Test suite() {
/**
* The test beans for each test.
*/
protected TestBean bean = null;
protected AlphaBean alphaBean1 = null;
protected TestBean bean;
protected AlphaBean alphaBean1;

protected AlphaBean alphaBean2 = null;
protected AlphaBean alphaBean2;

/**
* Constructs a new instance of this test case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static Test suite() {
/**
* The test bean for each test.
*/
protected TestBean bean = null;
protected TestBean bean;

/**
* The set of properties that should be described.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ public static Test suite() {
private long counter = 100000;

// DynaClass for inDyna and outDyna
private DynaClass dynaClass = null;
private DynaClass dynaClass;

// Input objects that have identical sets of properties and values.
private BenchBean inBean = null;
private DynaBean inDyna = null;
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

// Output objects that have identical sets of properties.
private BenchBean outBean = null;
private DynaBean outDyna = null;
private BenchBean outBean;
private DynaBean outDyna;

// BeanUtilsBean instance to be used
private BeanUtilsBean bu = null;
private BeanUtilsBean bu;

/**
* Constructs a new instance of this test case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BeanificationTestCase extends TestCase {

class Signal {
private Exception e;
private int signal = 0;
private int signal;
private BeanUtilsBean bean;
private PropertyUtilsBean propertyUtils;
private ConvertUtilsBean convertUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public static Test suite() {
/**
* The basic test bean for each test.
*/
protected DynaBean bean = null;
protected DynaBean bean;

/**
* The nested bean pointed at by the "nested" property.
*/
protected TestBean nested = null;
protected TestBean nested;

/**
* The set of properties that should be described.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static Test suite() {
/**
* The basic test bean for each test.
*/
protected DynaBean bean = null;
protected DynaBean bean;

/**
* The set of properties that should be described.
Expand All @@ -59,7 +59,7 @@ public static Test suite() {
/**
* The nested bean pointed at by the "nested" property.
*/
protected TestBean nested = null;
protected TestBean nested;

/**
* Constructs a new instance of this test case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class IndexedPropertyTestCase {
/**
* The test bean for each test.
*/
private IndexedTestBean bean = null;
private IndexedTestBean bean;
private BeanUtilsBean beanUtilsBean;
private PropertyUtilsBean propertyUtilsBean;
private String[] testArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public static void main(final String[] args) {
public static Test suite() {
return new TestSuite(LazyDynaBeanTestCase.class);
}
protected LazyDynaBean bean = null;
protected LazyDynaClass dynaClass = null;
protected LazyDynaBean bean;
protected LazyDynaClass dynaClass;
protected String testProperty = "myProperty";
protected String testPropertyA = "myProperty-A";
protected String testPropertyB = "myProperty-B";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static Test suite() {
return new TestSuite(LazyDynaClassTestCase.class);
}

protected LazyDynaClass dynaClass = null;
protected LazyDynaClass dynaClass;

protected String testProperty = "myProperty";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static void main(final String[] args) {
public static Test suite() {
return new TestSuite(LazyDynaMapTestCase.class);
}
protected LazyDynaMap dynaMap = null;
protected LazyDynaMap dynaMap;
protected String testProperty = "myProperty";
protected String testPropertyA = "myProperty-A";
protected String testPropertyB = "myProperty-B";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class NestedTestBean {

private String testString = "NOT SET";

private boolean testBoolean = false;
private boolean testBoolean;

private NestedTestBean[] indexedBeans;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ public static Test suite() {
private long counter = 100000;

// DynaClass for inDyna and outDyna
private DynaClass dynaClass = null;
private DynaClass dynaClass;

// Input objects that have identical sets of properties and values.
private BenchBean inBean = null;
private DynaBean inDyna = null;
private BenchBean inBean;
private DynaBean inDyna;
private Map<String, Object> inMap = null;

// Output objects that have identical sets of properties.
private BenchBean outBean = null;
private DynaBean outDyna = null;
private BenchBean outBean;
private DynaBean outDyna;

// PropertyUtilsBean instance to be used
private PropertyUtilsBean pu = null;
private PropertyUtilsBean pu;

/**
* Constructs a new instance of this test case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +118,27 @@ public static Test suite() {
/**
* The basic test bean for each test.
*/
protected TestBean bean = null;
protected TestBean bean;

/**
* The "package private subclass" test bean for each test.
*/
protected TestBeanPackageSubclass beanPackageSubclass = null;
protected TestBeanPackageSubclass beanPackageSubclass;

/**
* The test bean for private access tests.
*/
protected PrivateDirect beanPrivate = null;
protected PrivateDirect beanPrivate;

/**
* The test bean for private access tests of subclasses.
*/
protected PrivateDirect beanPrivateSubclass = null;
protected PrivateDirect beanPrivateSubclass;

/**
* The "public subclass" test bean for each test.
*/
protected TestBeanPublicSubclass beanPublicSubclass = null;
protected TestBeanPublicSubclass beanPublicSubclass;

/**
* The set of properties that should be described.
Expand Down
12 changes: 6 additions & 6 deletions src/test/java/org/apache/commons/beanutils2/TestBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,24 +171,24 @@ public static void incrementCounter(final Number amount) {
/**
* A nested reference to another test bean (populated as needed).
*/
private TestBean nested = null;
private TestBean nested;

/**
* Another nested reference to another test bean,
*/
private TestBean anotherNested = null;
private TestBean anotherNested;

/**
* Another nested reference to another test bean,
*/
private DynaBean nestedDynaBean = null;
private DynaBean nestedDynaBean;

private MappedTestBean mappedNested = null;
private MappedTestBean mappedNested;

/**
* A String property with an initial value of null.
*/
private String nullProperty = null;
private String nullProperty;

/**
* A read-only String property.
Expand Down Expand Up @@ -228,7 +228,7 @@ public static void incrementCounter(final Number amount) {
* described in the JavaBeans Specification, this will be considered a read-only boolean property, using isInvalidBoolean() as the getter.
* </p>
*/
private boolean invalidBoolean = false;
private boolean invalidBoolean;

public TestBean() {
listIndexed.add("String 0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Jira411TestCase extends TestCase {

public class DummyBean {

private String imgLink = null;
private String imgLink;

public String getImgLink() {
return imgLink;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class LocaleBeanificationTestCase {

class Signal {
private Exception e;
private int signal = 0;
private int signal;
private LocaleBeanUtilsBean bean;
private LocaleConvertUtilsBean convertUtils;
private Object marker;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static Test suite() {
/**
* The mock result set DynaClass to be tested.
*/
protected ResultSetDynaClass dynaClass = null;
protected ResultSetDynaClass dynaClass;

/**
* Names of the columns for this test. Must match the order they are defined in {@link TestResultSetMetaData}, and must be all lower case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static Test suite() {
/**
* The mock result set DynaClass to be tested.
*/
protected RowSetDynaClass dynaClass = null;
protected RowSetDynaClass dynaClass;

/**
* Names of the columns for this test. Must match the order they are defined in {@link TestResultSetMetaData}, and must be all lower case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static ResultSet createProxy(final InvocationHandler invocationHandler) {
/**
* Current row number (0 means "before the first one").
*/
protected int row = 0;
protected int row;

/**
* The constant (per run) value used to initialize date/time/timestamp.
Expand Down

0 comments on commit c94a5b7

Please sign in to comment.