diff --git a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/Five.java b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/Five.java index 9ecbfdd67..5556098f4 100644 --- a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/Five.java +++ b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/Five.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2011, 2015 XStream Committers. + * Copyright (C) 2008, 2009, 2011, 2015, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -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(); } -} \ No newline at end of file +} diff --git a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/FiveBean.java b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/FiveBean.java index a219f39c7..7e0d819ee 100644 --- a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/FiveBean.java +++ b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/FiveBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2011, 2015 XStream Committers. + * Copyright (C) 2009, 2011, 2015, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -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(); } -} \ No newline at end of file +} diff --git a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/SerializableFive.java b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/SerializableFive.java index cefc10d0b..2c0a5d8aa 100644 --- a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/SerializableFive.java +++ b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/model/SerializableFive.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2011, 2015 XStream Committers. + * Copyright (C) 2008, 2009, 2011, 2015, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -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(); } -} \ No newline at end of file +} diff --git a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/BasicTarget.java b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/BasicTarget.java index 582f717a8..8932afbbf 100644 --- a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/BasicTarget.java +++ b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/BasicTarget.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2011, 2015 XStream Committers. + * Copyright (C) 2008, 2009, 2011, 2015, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -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); } diff --git a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/ExtendedTarget.java b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/ExtendedTarget.java index cc0e78a94..71fbfab4d 100644 --- a/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/ExtendedTarget.java +++ b/xstream-benchmark/src/java/com/thoughtworks/xstream/tools/benchmark/targets/ExtendedTarget.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008, 2009, 2011, 2015 XStream Committers. + * Copyright (C) 2008, 2009, 2011, 2015, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -85,9 +85,9 @@ static class RunnableInvocationHandler implements InvocationHandler { public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.equals(EQUALS)) { - return new Boolean(args[0] instanceof Runnable); + return Boolean.valueOf(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")) { diff --git a/xstream-jmh/src/java/com/thoughtworks/xstream/benchmark/jmh/StringConverterBenchmark.java b/xstream-jmh/src/java/com/thoughtworks/xstream/benchmark/jmh/StringConverterBenchmark.java index 91f835914..bd71f53ce 100644 --- a/xstream-jmh/src/java/com/thoughtworks/xstream/benchmark/jmh/StringConverterBenchmark.java +++ b/xstream-jmh/src/java/com/thoughtworks/xstream/benchmark/jmh/StringConverterBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2015, 2017, 2021 XStream Committers. + * Copyright (C) 2015, 2017, 2021, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -39,7 +39,6 @@ import com.thoughtworks.xstream.io.xml.CompactWriter; import com.thoughtworks.xstream.io.xml.MXParserDriver; import com.thoughtworks.xstream.io.xml.PrettyPrintWriter; -import com.thoughtworks.xstream.io.xml.Xpp3Driver; import com.thoughtworks.xstream.security.ArrayTypePermission; import com.thoughtworks.xstream.security.NoTypePermission; @@ -171,7 +170,7 @@ private ConcurrentHashMapStringConverter(final ConcurrentMap map * @since 1.4.9 */ public ConcurrentHashMapStringConverter(final int lengthLimit) { - this(new ConcurrentHashMap(), lengthLimit); + this(new ConcurrentHashMap<>(), lengthLimit); } @Override diff --git a/xstream/src/java/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java b/xstream/src/java/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java index a1194eccc..10467dda2 100644 --- a/xstream/src/java/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java +++ b/xstream/src/java/com/thoughtworks/xstream/converters/reflection/AbstractReflectionConverter.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2018, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -191,7 +191,7 @@ public void writeItem(final Object item) { }; final Map> hiddenMappers = - new HashMap>(); + new HashMap<>(); for (final FieldInfo info : fields) { if (info.value != null) { final boolean isCollection = info.value instanceof Collection; diff --git a/xstream/src/java/com/thoughtworks/xstream/converters/reflection/NativeFieldKeySorter.java b/xstream/src/java/com/thoughtworks/xstream/converters/reflection/NativeFieldKeySorter.java index 544af247a..4349423db 100644 --- a/xstream/src/java/com/thoughtworks/xstream/converters/reflection/NativeFieldKeySorter.java +++ b/xstream/src/java/com/thoughtworks/xstream/converters/reflection/NativeFieldKeySorter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2014 XStream Committers. + * Copyright (C) 2007, 2014, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -26,7 +26,7 @@ public class NativeFieldKeySorter implements FieldKeySorter { @Override public Map sort(final Class type, final Map keyedByFieldKey) { - final Map map = new TreeMap(new Comparator() { + final Map map = new TreeMap<>(new Comparator() { @Override public int compare(final FieldKey fieldKey1, final FieldKey fieldKey2) { diff --git a/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java b/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java index 14a6d255e..3569bf03b 100644 --- a/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java +++ b/xstream/src/java/com/thoughtworks/xstream/converters/reflection/XStream12FieldKeySorter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2013, 2014 XStream Committers. + * Copyright (C) 2007, 2008, 2013, 2014, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -27,7 +27,7 @@ public class XStream12FieldKeySorter implements FieldKeySorter { @Override public Map sort(final Class type, final Map keyedByFieldKey) { - final Map map = new TreeMap(new Comparator() { + final Map map = new TreeMap<>(new Comparator() { @Override public int compare(final FieldKey fieldKey1, final FieldKey fieldKey2) { diff --git a/xstream/src/java/com/thoughtworks/xstream/core/DefaultConverterLookup.java b/xstream/src/java/com/thoughtworks/xstream/core/DefaultConverterLookup.java index 0e34bd576..e97dd2efe 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/DefaultConverterLookup.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/DefaultConverterLookup.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005, 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013, 2014, 2015, 2016, 2017, 2019 XStream Committers. + * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013, 2014, 2015, 2016, 2017, 2019, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -37,7 +37,7 @@ public class DefaultConverterLookup implements ConverterLookup, ConverterRegistr private Map serializationMap = null; public DefaultConverterLookup() { - this(new HashMap()); + this(new HashMap<>()); } /** @@ -107,7 +107,7 @@ private Object writeReplace() { } private Object readResolve() { - typeToConverterMap = serializationMap == null ? new HashMap() : serializationMap; + typeToConverterMap = serializationMap == null ? new HashMap<>() : serializationMap; serializationMap = null; return this; } diff --git a/xstream/src/java/com/thoughtworks/xstream/core/util/PresortedMap.java b/xstream/src/java/com/thoughtworks/xstream/core/util/PresortedMap.java index f22678a13..61885006d 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/util/PresortedMap.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/util/PresortedMap.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2010, 2014, 2015 XStream Committers. + * Copyright (C) 2006, 2007, 2010, 2014, 2015, 2022 XStream Committers. * All rights reserved. * * Created on 12.10.2010 by Joerg Schaible, extracted from TreeMapConverter. @@ -27,11 +27,11 @@ private static class ArraySet extends ArrayList implements Set { private final Comparator comparator; public PresortedMap() { - this(null, new ArraySet>()); + this(null, new ArraySet<>()); } public PresortedMap(final Comparator comparator) { - this(comparator, new ArraySet>()); + this(comparator, new ArraySet<>()); } private PresortedMap(final Comparator comparator, final PresortedMap.ArraySet> set) { diff --git a/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafePropertyEditor.java b/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafePropertyEditor.java index 77b63cf58..6d7d1892d 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafePropertyEditor.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafePropertyEditor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2008, 2014, 2016 XStream Committers. + * Copyright (c) 2007, 2008, 2014, 2016, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -42,7 +42,7 @@ public ThreadSafePropertyEditor( throw new IllegalArgumentException(type.getName() + " is not a " + PropertyEditor.class.getName()); } editorType = type; - pool = new Pool(initialPoolSize, maxPoolSize, new Pool.Factory() { + pool = new Pool<>(initialPoolSize, maxPoolSize, new Pool.Factory() { @Override public PropertyEditor newInstance() { ErrorWritingException ex = null; diff --git a/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafeSimpleDateFormat.java b/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafeSimpleDateFormat.java index 0ae5d10a1..981b16850 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafeSimpleDateFormat.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/util/ThreadSafeSimpleDateFormat.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2004, 2005 Joe Walnes. - * Copyright (C) 2006, 2007, 2009, 2011, 2012, 2014 XStream Committers. + * Copyright (C) 2006, 2007, 2009, 2011, 2012, 2014, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -51,7 +51,7 @@ public ThreadSafeSimpleDateFormat( final int maxPoolSize, final boolean lenient) { formatString = format; this.timeZone = timeZone; - pool = new Pool(initialPoolSize, maxPoolSize, new Pool.Factory() { + pool = new Pool<>(initialPoolSize, maxPoolSize, new Pool.Factory() { @Override public SimpleDateFormat newInstance() { final SimpleDateFormat dateFormat = new SimpleDateFormat(formatString, locale); diff --git a/xstream/src/java/com/thoughtworks/xstream/core/util/WeakCache.java b/xstream/src/java/com/thoughtworks/xstream/core/util/WeakCache.java index 780cbcf75..97531646f 100644 --- a/xstream/src/java/com/thoughtworks/xstream/core/util/WeakCache.java +++ b/xstream/src/java/com/thoughtworks/xstream/core/util/WeakCache.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011, 2013, 2014, 2015, 2019 XStream Committers. + * Copyright (C) 2011, 2013, 2014, 2015, 2019, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -42,7 +42,7 @@ public class WeakCache extends AbstractMap { * @since 1.4 */ public WeakCache() { - this(new WeakHashMap>()); + this(new WeakHashMap<>()); } /** diff --git a/xstream/src/java/com/thoughtworks/xstream/io/StatefulWriter.java b/xstream/src/java/com/thoughtworks/xstream/io/StatefulWriter.java index 9ec1d4f0d..7892db908 100644 --- a/xstream/src/java/com/thoughtworks/xstream/io/StatefulWriter.java +++ b/xstream/src/java/com/thoughtworks/xstream/io/StatefulWriter.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2006 Joe Walnes. - * Copyright (C) 2006, 2007, 2014, 2015 XStream Committers. + * Copyright (C) 2006, 2007, 2014, 2015, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -97,7 +97,7 @@ private void startNodeCommon() { } state = STATE_NODE_START; ++balance; - attributes.push(new HashSet()); + attributes.push(new HashSet<>()); } @Override diff --git a/xstream/src/java/com/thoughtworks/xstream/io/json/JettisonStaxWriter.java b/xstream/src/java/com/thoughtworks/xstream/io/json/JettisonStaxWriter.java index 3149b343e..53c2a950c 100644 --- a/xstream/src/java/com/thoughtworks/xstream/io/json/JettisonStaxWriter.java +++ b/xstream/src/java/com/thoughtworks/xstream/io/json/JettisonStaxWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2014, 2018 XStream Committers. + * Copyright (c) 2008, 2009, 2010, 2011, 2014, 2018, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -38,7 +38,7 @@ public class JettisonStaxWriter extends StaxWriter { private final MappedNamespaceConvention convention; - private final Deque stack = new ArrayDeque(); + private final Deque stack = new ArrayDeque<>(); /** * @since 1.4 diff --git a/xstream/src/java/com/thoughtworks/xstream/io/xml/TraxSource.java b/xstream/src/java/com/thoughtworks/xstream/io/xml/TraxSource.java index 13c1ab560..cd01c1c42 100644 --- a/xstream/src/java/com/thoughtworks/xstream/io/xml/TraxSource.java +++ b/xstream/src/java/com/thoughtworks/xstream/io/xml/TraxSource.java @@ -1,6 +1,6 @@ /* * Copyright (C) 2004 Joe Walnes. - * Copyright (C) 2006, 2007, 2013, 2014, 2015, 2020 XStream Committers. + * Copyright (C) 2006, 2007, 2013, 2014, 2015, 2020, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -286,7 +286,7 @@ public void setSourceAsList(final List list) { } @SuppressWarnings("unchecked") final List olist = (List)list; - source = list instanceof Queue ? (Queue)list : new ListWrappingQueue(olist); + source = list instanceof Queue ? (Queue)list : new ListWrappingQueue<>(olist); configureXMLReader(); } diff --git a/xstream/src/java/com/thoughtworks/xstream/mapper/AnnotationMapper.java b/xstream/src/java/com/thoughtworks/xstream/mapper/AnnotationMapper.java index 1eff98895..9476cdd7c 100644 --- a/xstream/src/java/com/thoughtworks/xstream/mapper/AnnotationMapper.java +++ b/xstream/src/java/com/thoughtworks/xstream/mapper/AnnotationMapper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016 XStream Committers. + * Copyright (C) 2007, 2008, 2009, 2011, 2012, 2013, 2014, 2015, 2016, 2022 XStream Committers. * All rights reserved. * * The software in this package is published under the terms of the BSD @@ -289,8 +289,8 @@ private void processConverterAnnotations(final Class type) { final XStreamConverters convertersAnnotation = type.getAnnotation(XStreamConverters.class); final XStreamConverter converterAnnotation = type.getAnnotation(XStreamConverter.class); final List annotations = convertersAnnotation != null - ? new ArrayList(Arrays.asList(convertersAnnotation.value())) - : new ArrayList(); + ? new ArrayList<>(Arrays.asList(convertersAnnotation.value())) + : new ArrayList<>(); if (converterAnnotation != null) { annotations.add(converterAnnotation); } diff --git a/xstream/src/java/com/thoughtworks/xstream/mapper/SecurityMapper.java b/xstream/src/java/com/thoughtworks/xstream/mapper/SecurityMapper.java index f0e92937d..c66603582 100644 --- a/xstream/src/java/com/thoughtworks/xstream/mapper/SecurityMapper.java +++ b/xstream/src/java/com/thoughtworks/xstream/mapper/SecurityMapper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014, 2015 XStream Committers. + * Copyright (C) 2014, 2015, 2022 XStream Committers. * All rights reserved. * * Created on 08. January 2014 by Joerg Schaible @@ -47,8 +47,8 @@ public SecurityMapper(final Mapper wrapped) { public SecurityMapper(final Mapper wrapped, final TypePermission... permissions) { super(wrapped); this.permissions = permissions == null // - ? new ArrayList() - : new ArrayList(Arrays.asList(permissions)); + ? new ArrayList<>() + : new ArrayList<>(Arrays.asList(permissions)); } /**