Skip to content

Commit

Permalink
XStream modules are using to be deleted Java APIs - Java9 version x-s…
Browse files Browse the repository at this point in the history
…tream#211

x-stream#211
Updates from CodeUpdater
https://j2eeguys.com/updater/

Signed-off-by: Steve Davidson <[email protected]>
  • Loading branch information
gorky committed Jul 29, 2020
1 parent 4438248 commit f63a84d
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public boolean equals(Object obj) {
}

public int hashCode() {
return super.hashCode() + two + new Boolean(three).hashCode() + five.toString().hashCode();
return super.hashCode() + two + Boolean.valueOf(three).hashCode() + five.toString().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ public boolean equals(Object obj) {
}

public int hashCode() {
return super.hashCode() + two + new Boolean(three).hashCode() + five.toString().hashCode();
return super.hashCode() + two + Boolean.valueOf(three).hashCode() + five.toString().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ public boolean equals(Object obj) {
}

public int hashCode() {
return super.hashCode() + two + new Boolean(three).hashCode() + five.toString().hashCode();
return super.hashCode() + two + Boolean.valueOf(three).hashCode() + five.toString().hashCode();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ public class BasicTarget implements Target {

public BasicTarget() {
list = new ArrayList();
list.add(new Integer(1));
list.add(new Byte((byte)2));
list.add(new Short((short)3));
list.add(new Long(4));
list.add(Integer.valueOf(1));
list.add(Byte.valueOf((byte)2));
list.add(Short.valueOf((short)3));
list.add(Long.valueOf(4));
list.add("Profile");
list.add(Boolean.TRUE);
list.add(new Float(1.2f));
list.add(new Double(1.2f));
list.add(Float.valueOf(1.2f));
list.add(Double.valueOf(1.2f));
list.add(new File("profile.txt"));
list.add(Locale.ENGLISH);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
if (method.equals(EQUALS)) {
return new Boolean(args[0] instanceof Runnable);
} else if (method.getName().equals("hashCode")) {
return new Integer(System.identityHashCode(proxy));
return Integer.valueOf(System.identityHashCode(proxy));
} else if (method.getName().equals("toString")) {
return "Proxy" + System.identityHashCode(proxy);
} else if (method.getName().equals("getClass")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void marshal(final Object source, final HierarchicalStreamWriter writer,
public Object unmarshal(final HierarchicalStreamReader reader, final UnmarshallingContext context) {
final String nullAttribute = reader.getAttribute("null");
if (nullAttribute != null && nullAttribute.equals("true")) {
return new Character('\0');
return Character.valueOf('\0');
} else {
return fromString(reader.getValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void marshal(final Object source, final HierarchicalStreamWriter writer,
}
try {
final Field field = type.getDeclaredField("serialVersionUID");
if (!field.isAccessible()) {
if (!(java.lang.reflect.Modifier.isStatic(field.getModifiers()) ? field.canAccess(null) : field.canAccess(source))) {
field.setAccessible(true);
}
final long serialVersionUID = field.getLong(null);
Expand Down Expand Up @@ -186,7 +186,7 @@ private Callback[] getCallbacks(final Object source) {
for (int i = 0; true; ++i) {
try {
final Field field = type.getDeclaredField(CALLBACK_MARKER + i);
if (!field.isAccessible()) {
if (!(java.lang.reflect.Modifier.isStatic(field.getModifiers()) ? field.canAccess(null) : field.canAccess(source))) {
field.setAccessible(true);
}
fields.add(field);
Expand Down Expand Up @@ -246,7 +246,7 @@ private Callback[] getCallbacks(final Object source) {
}
for (final Iterator<Method> iter = methods.iterator(); iter.hasNext();) {
final Method method = iter.next();
if (!method.isAccessible()) {
if (!(java.lang.reflect.Modifier.isStatic(method.getModifiers()) ? method.canAccess(null) : method.canAccess(source))) {
method.setAccessible(true);
}
if (Factory.class.isAssignableFrom(method.getDeclaringClass())
Expand Down Expand Up @@ -301,19 +301,19 @@ private Object[] createNullArguments(final Class<?>[] parameterTypes) {
final Class<?> type = parameterTypes[i];
if (type.isPrimitive()) {
if (type == byte.class) {
arguments[i] = new Byte((byte)0);
arguments[i] = Byte.valueOf((byte)0);
} else if (type == short.class) {
arguments[i] = new Short((short)0);
arguments[i] = Short.valueOf((short)0);
} else if (type == int.class) {
arguments[i] = new Integer(0);
arguments[i] = Integer.valueOf(0);
} else if (type == long.class) {
arguments[i] = new Long(0);
arguments[i] = Long.valueOf(0);
} else if (type == float.class) {
arguments[i] = new Float(0);
arguments[i] = Float.valueOf(0);
} else if (type == double.class) {
arguments[i] = new Double(0);
arguments[i] = Double.valueOf(0);
} else if (type == char.class) {
arguments[i] = new Character('\0');
arguments[i] = Character.valueOf('\0');
} else {
arguments[i] = Boolean.FALSE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public Object unmarshal(final HierarchicalStreamReader reader, final Unmarshalli
final Constructor<?> defaultConstructor;
try {
defaultConstructor = type.getDeclaredConstructor();
if (!defaultConstructor.isAccessible()) {
if (!defaultConstructor.canAccess(null)) {
defaultConstructor.setAccessible(true);
}
final Externalizable externalizable = (Externalizable)defaultConstructor.newInstance();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public Object newInstance(final Class<?> type) {
try {
for (final Constructor<?> constructor : type.getDeclaredConstructors()) {
if (constructor.getParameterTypes().length == 0) {
if (!constructor.isAccessible()) {
if (!constructor.canAccess(null)) {
constructor.setAccessible(true);
}
return constructor.newInstance(new Object[0]);
Expand Down
14 changes: 7 additions & 7 deletions xstream/src/java/com/thoughtworks/xstream/core/JVM.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ static class Test {
final Test t = (Test)provider.newInstance(Test.class);
try {
provider.writeField(t, "o", "object", Test.class);
provider.writeField(t, "c", new Character('c'), Test.class);
provider.writeField(t, "b", new Byte((byte)1), Test.class);
provider.writeField(t, "s", new Short((short)1), Test.class);
provider.writeField(t, "i", new Integer(1), Test.class);
provider.writeField(t, "l", new Long(1), Test.class);
provider.writeField(t, "f", new Float(1), Test.class);
provider.writeField(t, "d", new Double(1), Test.class);
provider.writeField(t, "c", Character.valueOf('c'), Test.class);
provider.writeField(t, "b", Byte.valueOf((byte)1), Test.class);
provider.writeField(t, "s", Short.valueOf((short)1), Test.class);
provider.writeField(t, "i", Integer.valueOf(1), Test.class);
provider.writeField(t, "l", Long.valueOf(1), Test.class);
provider.writeField(t, "f", Float.valueOf(1), Test.class);
provider.writeField(t, "d", Double.valueOf(1), Test.class);
provider.writeField(t, "bool", Boolean.TRUE, Test.class);
test = true;
} catch (final IncompatibleClassChangeError e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public final class Primitives {
{Integer.TYPE, Integer.class}, {Long.TYPE, Long.class}, {Float.TYPE, Float.class},
{Double.TYPE, Double.class}, {Boolean.TYPE, Boolean.class}, {Void.TYPE, Void.class},};
final Character[] representingChars = {
new Character('B'), new Character('C'), new Character('S'), new Character('I'), new Character('J'),
new Character('F'), new Character('D'), new Character('Z'), null};
Character.valueOf('B'), Character.valueOf('C'), Character.valueOf('S'), Character.valueOf('I'), Character.valueOf('J'),
Character.valueOf('F'), Character.valueOf('D'), Character.valueOf('Z'), null};
for (int i = 0; i < boxing.length; i++) {
final Class<?> primitiveType = boxing[i][0];
final Class<?> boxedType = boxing[i][1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ public void pushElement(final String name) {
indexMapStack[pointer] = indexMap;
}
if (indexMap.containsKey(name)) {
indexMap.put(name, new Integer(indexMap.get(name).intValue() + 1));
indexMap.put(name, Integer.valueOf(indexMap.get(name).intValue() + 1));
} else {
indexMap.put(name, new Integer(1));
indexMap.put(name, Integer.valueOf(1));
}
pointer++;
currentPath = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void add(final int index, final V element) {
for (int i = size; i > to; i--) {
map.put(Integer.valueOf(i + 1), map.get(Integer.valueOf(i)));
}
map.put(new Integer(index), element);
map.put(Integer.valueOf(index), element);
}

private void rangeCheck(final int index) {
Expand Down

0 comments on commit f63a84d

Please sign in to comment.