Skip to content

Commit

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

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

Also-by: Steve Davidson <[email protected]>
Signed-off-by: Sanddust <[email protected]>
  • Loading branch information
sanddusttx committed Jul 29, 2020
1 parent fd1b3f3 commit f7b6d39
Show file tree
Hide file tree
Showing 22 changed files with 60 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,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 @@ -62,6 +62,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 @@ -51,6 +51,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 @@ -30,14 +30,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 @@ -86,7 +86,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 @@ -28,7 +28,7 @@ public Object fromString(String str) {
if(value < Byte.MIN_VALUE || value > 0xFF) {
throw new NumberFormatException("For input string: \"" + str + '"');
}
return new Byte((byte)value);
return Byte.valueOf((byte)value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingC
public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
String nullAttribute = reader.getAttribute("null");
if (nullAttribute != null && nullAttribute.equals("true")) {
return new Character('\0');
return Character.valueOf('\0');
} else {
return fromString(reader.getValue());
}
}

public Object fromString(String str) {
if (str.length() == 0) {
return new Character('\0');
return Character.valueOf('\0');
} else {
return new Character(str.charAt(0));
return Character.valueOf(str.charAt(0));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Object fromString(String str) {
if(value < Integer.MIN_VALUE || value > 0xFFFFFFFFl) {
throw new NumberFormatException("For input string: \"" + str + '"');
}
return new Integer((int)value);
return Integer.valueOf((int)value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Object fromString(String str) {
return Long.decode(str);
}
final long num = high | low;
return new Long(num);
return Long.valueOf(num);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Object fromString(String str) {
if(value < Short.MIN_VALUE || value > 0xFFFF) {
throw new NumberFormatException("For input string: \"" + str + '"');
}
return new Short((short)value);
return Short.valueOf((short)value);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected StackTraceElement create(final String declaringClass, final String met
setField(result, "declaringClass", declaringClass);
setField(result, "methodName", methodName);
setField(result, "fileName", fileName);
setField(result, "lineNumber", new Integer(lineNumber));
setField(result, "lineNumber", Integer.valueOf(lineNumber));
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ private Map createCallbackIndexMap(Factory source) {
}
}
if (idxNoOp >= 0) {
Integer idx = new Integer(idxNoOp);
Integer idx = Integer.valueOf(idxNoOp);
for (final Iterator iter = methods.iterator(); iter.hasNext();) {
callbackIndexMap.put(iter.next(), idx);
}
Expand All @@ -306,7 +306,7 @@ private Object[] createNullArguments(Class[] parameterTypes) {
} else if (type == short.class) {
arguments[i] = new Short((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);
} else if (type == float.class) {
Expand Down Expand Up @@ -464,7 +464,7 @@ private static final class ReverseEngineeringInvocationHandler implements Invoca

public ReverseEngineeringInvocationHandler(int index, Map indexMap) {
this.indexMap = indexMap;
this.index = new Integer(index);
this.index = Integer.valueOf(index);
}

public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public Object unmarshal(final HierarchicalStreamReader reader, final Unmarshalli
final Constructor defaultConstructor;
try {
defaultConstructor = type.getDeclaredConstructor((Class[]) null);
if (!defaultConstructor.isAccessible()) {
if (!defaultConstructor.canAccess(null)) {
defaultConstructor.setAccessible(true);
}
final Externalizable externalizable = (Externalizable) defaultConstructor.newInstance((Object[]) null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public Object newInstance(Class type) {
for (int i = 0; i < constructors.length; i++) {
final Constructor constructor = constructors[i];
if (constructor.getParameterTypes().length == 0) {
if (!constructor.isAccessible()) {
if (!constructor.canAccess(null)) {
constructor.setAccessible(true);
}
return constructor.newInstance(new Object[0]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private void write(Field field, Object object, Object value) {
private synchronized long getFieldOffset(Field f) {
Long l = (Long)fieldOffsetCache.get(f);
if (l == null) {
l = new Long(unsafe.objectFieldOffset(f));
l = Long.valueOf(unsafe.objectFieldOffset(f));
fieldOffsetCache.put(f, l);
}

Expand Down
12 changes: 6 additions & 6 deletions xstream/src/java/com/thoughtworks/xstream/core/JVM.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ static class Test {
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, "c", Character.valueOf('c'), Test.class);
provider.writeField(t, "b", Byte.valueOf((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, "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(IncompatibleClassChangeError e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,23 +96,23 @@ public void writeByte(int val) throws IOException {
}

public void writeInt(int val) throws IOException {
peekCallback().writeToStream(new Integer(val));
peekCallback().writeToStream(Integer.valueOf(val));
}

public void writeChar(int val) throws IOException {
peekCallback().writeToStream(new Character((char)val));
peekCallback().writeToStream(Character.valueOf((char)val));
}

public void writeDouble(double val) throws IOException {
peekCallback().writeToStream(new Double(val));
peekCallback().writeToStream(Double.valueOf(val));
}

public void writeFloat(float val) throws IOException {
peekCallback().writeToStream(new Float(val));
peekCallback().writeToStream(Float.valueOf(val));
}

public void writeLong(long val) throws IOException {
peekCallback().writeToStream(new Long(val));
peekCallback().writeToStream(Long.valueOf(val));
}

public void writeShort(int val) throws IOException {
Expand Down Expand Up @@ -177,27 +177,27 @@ public void put(String name, Object val) {
}

public void put(String name, byte val) {
put(name, new Byte(val));
put(name, Byte.valueOf(val));
}

public void put(String name, char val) {
put(name, new Character(val));
put(name, Character.valueOf(val));
}

public void put(String name, double val) {
put(name, new Double(val));
put(name, Double.valueOf(val));
}

public void put(String name, float val) {
put(name, new Float(val));
put(name, Float.valueOf(val));
}

public void put(String name, int val) {
put(name, new Integer(val));
put(name, Integer.valueOf(val));
}

public void put(String name, long val) {
put(name, new Long(val));
put(name, Long.valueOf(val));
}

public void put(String name, short val) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ public final class Primitives {
{ 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'),
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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ private static class IdRegistry {
private Map map = new HashMap();

public void put(long id, String value) {
map.put(new Long(id), value);
map.put(Long.valueOf(id), value);
}

public String get(long id) {
String result = (String) map.get(new Long(id));
String result = (String) map.get(Long.valueOf(id));
if (result == null) {
throw new StreamException("Unknown ID : " + id);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void pushElement(String name) {
if (indexMap.containsKey(name)) {
indexMap.put(name, new Integer(((Integer) 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 @@ -33,7 +33,7 @@ public int size() {
public Object set(int index, Object element) {
rangeCheck(index);
Object value = get(index);
map.put(new Integer(index), element);
map.put(Integer.valueOf(index), element);
return value;
}

Expand All @@ -45,9 +45,9 @@ public void add(int index, Object element) {
}
int to = index != size ? index - 1 : index;
for (int i = size; i > to; i--) {
map.put(new Integer(i + 1), map.get(new Integer(i)));
map.put(new Integer(i + 1), map.get(Integer.valueOf(i)));
}
map.put(new Integer(index), element);
map.put(Integer.valueOf(index), element);
}

private void rangeCheck(int index) {
Expand All @@ -60,15 +60,15 @@ private void rangeCheck(int index) {

public Object get(int index) {
rangeCheck(index);
return map.get(new Integer(index));
return map.get(Integer.valueOf(index));
}

public Object remove(int index) {
int size = size();
rangeCheck(index);
Object value = map.get(new Integer(index));
Object value = map.get(Integer.valueOf(index));
for (int i = index; i < size - 1; i++) {
map.put(new Integer(i), map.get(new Integer(i + 1)));
map.put(Integer.valueOf(i), map.get(new Integer(i + 1)));
}
map.remove(new Integer(size - 1));
return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ public boolean add(Object o) {

private Long findEmptyKey() {
long i = System.currentTimeMillis();
while (map.containsKey(new Long(i))) {
while (map.containsKey(Long.valueOf(i))) {
i++;
}
return new Long(i);
return Long.valueOf(i);
}

}

0 comments on commit f7b6d39

Please sign in to comment.