Skip to content

Commit a45232e

Browse files
committed
Migrate from APIs deprecated in Java 9
1 parent 82ba334 commit a45232e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/main/java/org/apache/commons/beanutils/LazyDynaBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@
8181
* <pre>DynaBean myBean = new LazyDynaBean();
8282
* MutableDynaClass myClass = (MutableDynaClass)myBean.getDynaClass();
8383
* myClass.add("myIndexedProperty", int[].class);
84-
* myBean.set("myIndexedProperty", 0, new Integer(10));
85-
* myBean.set("myIndexedProperty", 1, new Integer(20));</pre>
84+
* myBean.set("myIndexedProperty", 0, Integer.valueOf(10));
85+
* myBean.set("myIndexedProperty", 1, Integer.valueOf(20));</pre>
8686
*
8787
* <p><strong><u>Setting Mapped Properties</u></strong></p>
8888
* <p>If the property <strong>doesn't</strong> exist, the <code>LazyDynaBean</code> will automatically add

src/test/java/org/apache/commons/beanutils/LazyDynaMapTestCase.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ public static Test suite() {
5252
protected String testPropertyB = "myProperty-B";
5353
protected String testString1 = "myStringValue-1";
5454
protected String testString2 = "myStringValue-2";
55-
protected Integer testInteger1 = new Integer(30);
55+
protected Integer testInteger1 = Integer.valueOf(30);
5656

57-
protected Integer testInteger2 = new Integer(40);
57+
protected Integer testInteger2 = Integer.valueOf(40);
5858

5959
protected String testKey = "myKey";
6060

@@ -159,13 +159,13 @@ public void testIndexedLinkedList() {
159159
dynaMap.set(testProperty, index, testString1);
160160
assertEquals("Check Property type is correct", LinkedList.class, dynaMap.get(testProperty).getClass());
161161
assertEquals("Check First Indexed Value is correct", testString1, dynaMap.get(testProperty, index));
162-
assertEquals("Check First Array length is correct", new Integer(index+1), new Integer(((LinkedList<?>)dynaMap.get(testProperty)).size()));
162+
assertEquals("Check First Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((LinkedList<?>)dynaMap.get(testProperty)).size()));
163163

164164
// Set a second indexed value, should automatically grow the LinkedList and set appropriate indexed value
165165
index = index + 2;
166166
dynaMap.set(testProperty, index, testInteger1);
167167
assertEquals("Check Second Indexed Value is correct", testInteger1, dynaMap.get(testProperty, index));
168-
assertEquals("Check Second Array length is correct", new Integer(index+1), new Integer(((LinkedList<?>)dynaMap.get(testProperty)).size()));
168+
assertEquals("Check Second Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((LinkedList<?>)dynaMap.get(testProperty)).size()));
169169
}
170170

171171
/**
@@ -191,14 +191,14 @@ public void testIndexedObjectArray() {
191191
assertEquals("Check Indexed Property is correct type", objectArray.getClass(), dynaMap.get(testProperty).getClass());
192192
assertEquals("Check First Indexed Value is correct(a)", testString1, dynaMap.get(testProperty, index));
193193
assertEquals("Check First Indexed Value is correct(b)", testString1, ((String[])dynaMap.get(testProperty))[index]);
194-
assertEquals("Check Array length is correct", new Integer(index+1), new Integer(((String[])dynaMap.get(testProperty)).length));
194+
assertEquals("Check Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((String[])dynaMap.get(testProperty)).length));
195195

196196
// Set a second indexed value, should automatically grow the String[] and set appropriate indexed value
197197
index = index + 2;
198198
dynaMap.set(testProperty, index, testString2);
199199
assertEquals("Check Second Indexed Value is correct(a)", testString2, dynaMap.get(testProperty, index));
200200
assertEquals("Check Second Indexed Value is correct(b)", testString2, ((String[])dynaMap.get(testProperty))[index]);
201-
assertEquals("Check Second Array length is correct", new Integer(index+1), new Integer(((String[])dynaMap.get(testProperty)).length));
201+
assertEquals("Check Second Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((String[])dynaMap.get(testProperty)).length));
202202
}
203203

204204
/**
@@ -223,15 +223,15 @@ public void testIndexedPrimitiveArray() {
223223
assertNotNull("Check Indexed Property is not null", dynaMap.get(testProperty));
224224
assertEquals("Check Indexed Property is correct type", primitiveArray.getClass(), dynaMap.get(testProperty).getClass());
225225
assertEquals("Check First Indexed Value is correct(a)", testInteger1, dynaMap.get(testProperty, index));
226-
assertEquals("Check First Indexed Value is correct(b)", testInteger1, new Integer(((int[])dynaMap.get(testProperty))[index]));
227-
assertEquals("Check Array length is correct", new Integer(index+1), new Integer(((int[])dynaMap.get(testProperty)).length));
226+
assertEquals("Check First Indexed Value is correct(b)", testInteger1, Integer.valueOf(((int[])dynaMap.get(testProperty))[index]));
227+
assertEquals("Check Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((int[])dynaMap.get(testProperty)).length));
228228

229229
// Set a second indexed value, should automatically grow the int[] and set appropriate indexed value
230230
index = index + 2;
231231
dynaMap.set(testProperty, index, testInteger2);
232232
assertEquals("Check Second Indexed Value is correct(a)", testInteger2, dynaMap.get(testProperty, index));
233-
assertEquals("Check Second Indexed Value is correct(b)", testInteger2, new Integer(((int[])dynaMap.get(testProperty))[index]));
234-
assertEquals("Check Second Array length is correct", new Integer(index+1), new Integer(((int[])dynaMap.get(testProperty)).length));
233+
assertEquals("Check Second Indexed Value is correct(b)", testInteger2, Integer.valueOf(((int[])dynaMap.get(testProperty))[index]));
234+
assertEquals("Check Second Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((int[])dynaMap.get(testProperty)).length));
235235

236236
}
237237

@@ -252,13 +252,13 @@ public void testIndexedPropertyDefault() {
252252
assertNotNull("Check Indexed Property is not null", dynaMap.get(testProperty));
253253
assertEquals("Check Indexed Property is correct type", ArrayList.class, dynaMap.get(testProperty).getClass());
254254
assertEquals("Check First Indexed Value is correct", testInteger1, dynaMap.get(testProperty, index));
255-
assertEquals("Check First Array length is correct", new Integer(index+1), new Integer(((ArrayList<?>)dynaMap.get(testProperty)).size()));
255+
assertEquals("Check First Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((ArrayList<?>)dynaMap.get(testProperty)).size()));
256256

257257
// Set a second indexed value, should automatically grow the ArrayList and set appropriate indexed value
258258
index = index + 2;
259259
dynaMap.set(testProperty, index, testString1);
260260
assertEquals("Check Second Indexed Value is correct", testString1, dynaMap.get(testProperty, index));
261-
assertEquals("Check Second Array length is correct", new Integer(index+1), new Integer(((ArrayList<?>)dynaMap.get(testProperty)).size()));
261+
assertEquals("Check Second Array length is correct", Integer.valueOf(index+1), Integer.valueOf(((ArrayList<?>)dynaMap.get(testProperty)).size()));
262262
}
263263

264264
/**
@@ -316,7 +316,7 @@ public void testIndexedPropertyUtils() {
316316
* Test setting mapped property for type which is not Map
317317
*/
318318
public void testMappedInvalidType() {
319-
dynaMap.set(testProperty, new Integer(1));
319+
dynaMap.set(testProperty, Integer.valueOf(1));
320320
assertFalse("Check Property is not mapped", dynaMap.getDynaProperty(testProperty).isMapped());
321321
try {
322322
dynaMap.set(testProperty, testKey, testInteger1);

0 commit comments

Comments
 (0)