Skip to content

Commit f63a84d

Browse files
committed
XStream modules are using to be deleted Java APIs - Java9 version x-stream#211
x-stream#211 Updates from CodeUpdater https://j2eeguys.com/updater/ Signed-off-by: Steve Davidson <[email protected]>
1 parent 4438248 commit f63a84d

File tree

13 files changed

+35
-35
lines changed

13 files changed

+35
-35
lines changed

xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/Five.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,6 @@ public boolean equals(Object obj) {
3939
}
4040

4141
public int hashCode() {
42-
return super.hashCode() + two + new Boolean(three).hashCode() + five.toString().hashCode();
42+
return super.hashCode() + two + Boolean.valueOf(three).hashCode() + five.toString().hashCode();
4343
}
4444
}

xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/FiveBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ public boolean equals(Object obj) {
6363
}
6464

6565
public int hashCode() {
66-
return super.hashCode() + two + new Boolean(three).hashCode() + five.toString().hashCode();
66+
return super.hashCode() + two + Boolean.valueOf(three).hashCode() + five.toString().hashCode();
6767
}
6868
}

xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/SerializableFive.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ public boolean equals(Object obj) {
5252
}
5353

5454
public int hashCode() {
55-
return super.hashCode() + two + new Boolean(three).hashCode() + five.toString().hashCode();
55+
return super.hashCode() + two + Boolean.valueOf(three).hashCode() + five.toString().hashCode();
5656
}
5757
}

xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/BasicTarget.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public class BasicTarget implements Target {
3131

3232
public BasicTarget() {
3333
list = new ArrayList();
34-
list.add(new Integer(1));
35-
list.add(new Byte((byte)2));
36-
list.add(new Short((short)3));
37-
list.add(new Long(4));
34+
list.add(Integer.valueOf(1));
35+
list.add(Byte.valueOf((byte)2));
36+
list.add(Short.valueOf((short)3));
37+
list.add(Long.valueOf(4));
3838
list.add("Profile");
3939
list.add(Boolean.TRUE);
40-
list.add(new Float(1.2f));
41-
list.add(new Double(1.2f));
40+
list.add(Float.valueOf(1.2f));
41+
list.add(Double.valueOf(1.2f));
4242
list.add(new File("profile.txt"));
4343
list.add(Locale.ENGLISH);
4444
}

xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/ExtendedTarget.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
8787
if (method.equals(EQUALS)) {
8888
return new Boolean(args[0] instanceof Runnable);
8989
} else if (method.getName().equals("hashCode")) {
90-
return new Integer(System.identityHashCode(proxy));
90+
return Integer.valueOf(System.identityHashCode(proxy));
9191
} else if (method.getName().equals("toString")) {
9292
return "Proxy" + System.identityHashCode(proxy);
9393
} else if (method.getName().equals("getClass")) {

xstream/src/java/com/thoughtworks/xstream/converters/basic/CharConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void marshal(final Object source, final HierarchicalStreamWriter writer,
4242
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
4343
final String nullAttribute = reader.getAttribute("null");
4444
if (nullAttribute != null && nullAttribute.equals("true")) {
45-
return new Character('\0');
45+
return Character.valueOf('\0');
4646
} else {
4747
return fromString(reader.getValue());
4848
}

xstream/src/java/com/thoughtworks/xstream/converters/reflection/CGLIBEnhancedConverter.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public void marshal(final Object source, final HierarchicalStreamWriter writer,
156156
}
157157
try {
158158
final Field field = type.getDeclaredField("serialVersionUID");
159-
if (!field.isAccessible()) {
159+
if (!(java.lang.reflect.Modifier.isStatic(field.getModifiers()) ? field.canAccess(null) : field.canAccess(source))) {
160160
field.setAccessible(true);
161161
}
162162
final long serialVersionUID = field.getLong(null);
@@ -186,7 +186,7 @@ private Callback[] getCallbacks(final Object source) {
186186
for (int i = 0; true; ++i) {
187187
try {
188188
final Field field = type.getDeclaredField(CALLBACK_MARKER + i);
189-
if (!field.isAccessible()) {
189+
if (!(java.lang.reflect.Modifier.isStatic(field.getModifiers()) ? field.canAccess(null) : field.canAccess(source))) {
190190
field.setAccessible(true);
191191
}
192192
fields.add(field);
@@ -246,7 +246,7 @@ private Callback[] getCallbacks(final Object source) {
246246
}
247247
for (final Iterator<Method> iter = methods.iterator(); iter.hasNext();) {
248248
final Method method = iter.next();
249-
if (!method.isAccessible()) {
249+
if (!(java.lang.reflect.Modifier.isStatic(method.getModifiers()) ? method.canAccess(null) : method.canAccess(source))) {
250250
method.setAccessible(true);
251251
}
252252
if (Factory.class.isAssignableFrom(method.getDeclaringClass())
@@ -301,19 +301,19 @@ private Object[] createNullArguments(final Class<?>[] parameterTypes) {
301301
final Class<?> type = parameterTypes[i];
302302
if (type.isPrimitive()) {
303303
if (type == byte.class) {
304-
arguments[i] = new Byte((byte)0);
304+
arguments[i] = Byte.valueOf((byte)0);
305305
} else if (type == short.class) {
306-
arguments[i] = new Short((short)0);
306+
arguments[i] = Short.valueOf((short)0);
307307
} else if (type == int.class) {
308-
arguments[i] = new Integer(0);
308+
arguments[i] = Integer.valueOf(0);
309309
} else if (type == long.class) {
310-
arguments[i] = new Long(0);
310+
arguments[i] = Long.valueOf(0);
311311
} else if (type == float.class) {
312-
arguments[i] = new Float(0);
312+
arguments[i] = Float.valueOf(0);
313313
} else if (type == double.class) {
314-
arguments[i] = new Double(0);
314+
arguments[i] = Double.valueOf(0);
315315
} else if (type == char.class) {
316-
arguments[i] = new Character('\0');
316+
arguments[i] = Character.valueOf('\0');
317317
} else {
318318
arguments[i] = Boolean.FALSE;
319319
}

xstream/src/java/com/thoughtworks/xstream/converters/reflection/ExternalizableConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public Object unmarshal(final HierarchicalStreamReader reader, final Unmarshalli
149149
final Constructor<?> defaultConstructor;
150150
try {
151151
defaultConstructor = type.getDeclaredConstructor();
152-
if (!defaultConstructor.isAccessible()) {
152+
if (!defaultConstructor.canAccess(null)) {
153153
defaultConstructor.setAccessible(true);
154154
}
155155
final Externalizable externalizable = (Externalizable)defaultConstructor.newInstance();

xstream/src/java/com/thoughtworks/xstream/converters/reflection/PureJavaReflectionProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public Object newInstance(final Class<?> type) {
6565
try {
6666
for (final Constructor<?> constructor : type.getDeclaredConstructors()) {
6767
if (constructor.getParameterTypes().length == 0) {
68-
if (!constructor.isAccessible()) {
68+
if (!constructor.canAccess(null)) {
6969
constructor.setAccessible(true);
7070
}
7171
return constructor.newInstance(new Object[0]);

xstream/src/java/com/thoughtworks/xstream/core/JVM.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ static class Test {
119119
final Test t = (Test)provider.newInstance(Test.class);
120120
try {
121121
provider.writeField(t, "o", "object", Test.class);
122-
provider.writeField(t, "c", new Character('c'), Test.class);
123-
provider.writeField(t, "b", new Byte((byte)1), Test.class);
124-
provider.writeField(t, "s", new Short((short)1), Test.class);
125-
provider.writeField(t, "i", new Integer(1), Test.class);
126-
provider.writeField(t, "l", new Long(1), Test.class);
127-
provider.writeField(t, "f", new Float(1), Test.class);
128-
provider.writeField(t, "d", new Double(1), Test.class);
122+
provider.writeField(t, "c", Character.valueOf('c'), Test.class);
123+
provider.writeField(t, "b", Byte.valueOf((byte)1), Test.class);
124+
provider.writeField(t, "s", Short.valueOf((short)1), Test.class);
125+
provider.writeField(t, "i", Integer.valueOf(1), Test.class);
126+
provider.writeField(t, "l", Long.valueOf(1), Test.class);
127+
provider.writeField(t, "f", Float.valueOf(1), Test.class);
128+
provider.writeField(t, "d", Double.valueOf(1), Test.class);
129129
provider.writeField(t, "bool", Boolean.TRUE, Test.class);
130130
test = true;
131131
} catch (final IncompatibleClassChangeError e) {

xstream/src/java/com/thoughtworks/xstream/core/util/Primitives.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public final class Primitives {
3232
{Integer.TYPE, Integer.class}, {Long.TYPE, Long.class}, {Float.TYPE, Float.class},
3333
{Double.TYPE, Double.class}, {Boolean.TYPE, Boolean.class}, {Void.TYPE, Void.class},};
3434
final Character[] representingChars = {
35-
new Character('B'), new Character('C'), new Character('S'), new Character('I'), new Character('J'),
36-
new Character('F'), new Character('D'), new Character('Z'), null};
35+
Character.valueOf('B'), Character.valueOf('C'), Character.valueOf('S'), Character.valueOf('I'), Character.valueOf('J'),
36+
Character.valueOf('F'), Character.valueOf('D'), Character.valueOf('Z'), null};
3737
for (int i = 0; i < boxing.length; i++) {
3838
final Class<?> primitiveType = boxing[i][0];
3939
final Class<?> boxedType = boxing[i][1];

xstream/src/java/com/thoughtworks/xstream/io/path/PathTracker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ public void pushElement(final String name) {
8585
indexMapStack[pointer] = indexMap;
8686
}
8787
if (indexMap.containsKey(name)) {
88-
indexMap.put(name, new Integer(indexMap.get(name).intValue() + 1));
88+
indexMap.put(name, Integer.valueOf(indexMap.get(name).intValue() + 1));
8989
} else {
90-
indexMap.put(name, new Integer(1));
90+
indexMap.put(name, Integer.valueOf(1));
9191
}
9292
pointer++;
9393
currentPath = null;

xstream/src/java/com/thoughtworks/xstream/persistence/XmlArrayList.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void add(final int index, final V element) {
5050
for (int i = size; i > to; i--) {
5151
map.put(Integer.valueOf(i + 1), map.get(Integer.valueOf(i)));
5252
}
53-
map.put(new Integer(index), element);
53+
map.put(Integer.valueOf(index), element);
5454
}
5555

5656
private void rangeCheck(final int index) {

0 commit comments

Comments
 (0)