'new Character' is deprecated in Java

replace with Character.valueOf

Change-Id: I9938db0fce6490eba6f4900efc3c139a1b71d120
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158786
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2023-11-02 09:54:28 +02:00
parent 30877bdc01
commit 00e1ac51e6
19 changed files with 55 additions and 55 deletions

View file

@ -76,7 +76,7 @@ public class PropertySet_Test
cl.setPropertyValue("PropBoolA", value);
assertEquals(cl.getPropertyValue("PropBoolA"), value);
value= new Character('A');
value= Character.valueOf('A');
cl.setPropertyValue("PropCharA",value);
assertEquals(cl.getPropertyValue("PropCharA"), value);
@ -149,7 +149,7 @@ public class PropertySet_Test
cl.setPropertyValue("PropObjectA", value);
assertEquals(cl.getPropertyValue("PropObjectA"), value);
value= new Character('A');
value= Character.valueOf('A');
cl.setPropertyValue("PropObjectA",value);
assertEquals(cl.getPropertyValue("PropObjectA"), value);
@ -208,7 +208,7 @@ public class PropertySet_Test
assertTrue(ret instanceof Any);
assertTrue(util.anyEquals(value, ret));
value= new Character('A');
value= Character.valueOf('A');
cl.setPropertyValue("PropAnyA",value);
ret= cl.getPropertyValue("PropAnyA");
assertTrue(ret instanceof Any);
@ -288,7 +288,7 @@ public class PropertySet_Test
assertTrue(ret instanceof Boolean);
assertTrue(util.anyEquals(value, ret));
value= new Any (new Type(char.class), new Character('A'));
value= new Any (new Type(char.class), Character.valueOf('A'));
cl.setPropertyValue("PropCharA",value);
ret= cl.getPropertyValue("PropCharA");
assertTrue(ret instanceof Character);
@ -368,7 +368,7 @@ public class PropertySet_Test
assertTrue(ret instanceof Any);
assertTrue(util.anyEquals(value, ret));
value= new Any (new Type(char.class), new Character('A'));
value= new Any (new Type(char.class), Character.valueOf('A'));
cl.setPropertyValue("PropAnyA",value);
ret= cl.getPropertyValue("PropAnyA");
assertTrue(ret instanceof Any);
@ -446,7 +446,7 @@ public class PropertySet_Test
cl.setPropertyValue("PropBoolClass", value);
assertEquals(cl.getPropertyValue("PropBoolClass"), value);
value= new Character('A');
value= Character.valueOf('A');
cl.setPropertyValue("PropCharClass",value);
assertEquals(cl.getPropertyValue("PropCharClass"), value);
@ -484,7 +484,7 @@ public class PropertySet_Test
assertTrue(ret instanceof Boolean);
assertTrue(util.anyEquals(value, ret));
value= new Any (new Type(char.class), new Character('A'));
value= new Any (new Type(char.class), Character.valueOf('A'));
cl.setPropertyValue("PropCharClass",value);
ret= cl.getPropertyValue("PropCharClass");
assertTrue(ret instanceof Character);
@ -946,7 +946,7 @@ public class PropertySet_Test
TestClass cl= new TestClass();
cl.setPropertyValues(new String[0], new Object[0]);
String[] arNames= new String[] {"PropCharA","PropIntClass","PropObjectA"};
Character aChar= new Character('A');
Character aChar= Character.valueOf('A');
Integer aInt= Integer.valueOf(111);
Byte aByte= Byte.valueOf((byte)11);
Object[] values= new Object[]{aChar, aInt, aByte};
@ -986,11 +986,11 @@ public class PropertySet_Test
Listener li1= new Listener();
cl.addPropertiesChangeListener(new String[]{"PropCharA"}, li1);
cl.setPropertyValue("PropCharA", new Character('B'));
cl.setPropertyValue("PropCharA", Character.valueOf('B'));
assertEquals(li1.nPropertiesChange, 0);
cl.propCharA.Attributes= PropertyAttribute.BOUND;
cl.setPropertyValue("PropCharA", new Character('C'));
cl.setPropertyValue("PropCharA", Character.valueOf('C'));
assertEquals(li1.nPropertiesChange, 1);
PropertyChangeEvent evt= li1.arEvt[0];
@ -1000,7 +1000,7 @@ public class PropertySet_Test
li1.reset();
cl.removePropertiesChangeListener(li1);
cl.setPropertyValue("PropCharA", new Character('F'));
cl.setPropertyValue("PropCharA", Character.valueOf('F'));
assertEquals(li1.nPropertiesChange, 0);
}
@ -1165,17 +1165,17 @@ class TestClass extends PropertySet
assertEquals(outNewVal[0], value);
assertEquals(outOldVal[0], Boolean.FALSE);
value= new Character('A');
value= Character.valueOf('A');
assertTrue(convertPropertyValue(propCharA, outNewVal, outOldVal, value));
assertTrue(outNewVal[0] instanceof Character);
assertEquals(outNewVal[0], value);
assertEquals(outOldVal[0], new Character((char)0));
assertEquals(outOldVal[0], Character.valueOf((char)0));
charPropA= 'B';
assertTrue(convertPropertyValue(propCharA, outNewVal, outOldVal, value));
assertTrue(outNewVal[0] instanceof Character);
assertEquals(outNewVal[0], value);
assertEquals(outOldVal[0], new Character('B'));
assertEquals(outOldVal[0], Character.valueOf('B'));
value= Byte.valueOf((byte) 111);
assertTrue(convertPropertyValue(propByteA, outNewVal, outOldVal, value));
@ -1328,7 +1328,7 @@ class TestClass extends PropertySet
assertTrue(outNewVal[0] instanceof Boolean);
assertEquals(outNewVal[0], value);
value= new Character('A');
value= Character.valueOf('A');
assertTrue(convertPropertyValue(propCharClass, outNewVal, outOldVal, value));
assertTrue(outNewVal[0] instanceof Character);
assertEquals(outNewVal[0], value);
@ -1372,7 +1372,7 @@ class TestClass extends PropertySet
setPropertyValueNoBroadcast(propBoolA, value);
assertEquals(boolPropA, ((Boolean) value).booleanValue());
value= new Character('A');
value= Character.valueOf('A');
setPropertyValueNoBroadcast(propCharA, value);
assertEquals(charPropA, ((Character) value).charValue());
@ -1555,7 +1555,7 @@ class TestClass2 extends PropertySet
result= true;
assertTrue(result);
}
Object val= new Character('A');
Object val= Character.valueOf('A');
setPropertyValue("charA", val);
assertEquals(val, getPropertyValue("charA"));
setPropertyValue("charClassB",val);

View file

@ -210,7 +210,7 @@ public class MyPersistObject implements XPersistObject, XTypeProvider,
if ( property.equals(props[1].Name))
return Integer.valueOf(i);
if ( property.equals(props[2].Name))
return new Character(c);
return Character.valueOf(c);
if ( property.equals(props[3].Name))
return Double.valueOf(d);
if ( property.equals(props[4].Name))

View file

@ -112,7 +112,7 @@ public class DataInputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>();
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -101,7 +101,7 @@ public class DataOutputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -124,7 +124,7 @@ public class MarkableOutputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -213,7 +213,7 @@ public class ObjectInputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -205,7 +205,7 @@ public class ObjectOutputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -111,7 +111,7 @@ public class DataInputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -100,7 +100,7 @@ public class DataOutputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -123,7 +123,7 @@ public class MarkableOutputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -219,7 +219,7 @@ public class ObjectInputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -204,7 +204,7 @@ public class ObjectOutputStream extends TestCase {
ArrayList<Object> data = new ArrayList<Object>() ;
data.add(Boolean.TRUE) ;
data.add(Byte.valueOf((byte)123)) ;
data.add(new Character((char)1234)) ;
data.add(Character.valueOf((char)1234)) ;
data.add(Short.valueOf((short)1234)) ;
data.add(Integer.valueOf(123456)) ;
data.add(Float.valueOf(1.234f)) ;

View file

@ -737,7 +737,7 @@ XMultiPropertySet
else if(cl.equals(boolean.class))
retVal= Boolean.valueOf(AnyConverter.toBoolean(obj));
else if (cl.equals(char.class))
retVal= new Character(AnyConverter.toChar(obj));
retVal= Character.valueOf(AnyConverter.toChar(obj));
else if (cl.equals(byte.class))
retVal= Byte.valueOf(AnyConverter.toByte(obj));
else if (cl.equals(short.class))
@ -759,7 +759,7 @@ XMultiPropertySet
else if (cl.equals(Boolean.class))
retVal= Boolean.valueOf(AnyConverter.toBoolean(obj));
else if (cl.equals(Character.class))
retVal= new Character(AnyConverter.toChar(obj));
retVal= Character.valueOf(AnyConverter.toChar(obj));
else if (cl.equals(Byte.class))
retVal= Byte.valueOf(AnyConverter.toByte(obj));
else if (cl.equals(Short.class))

View file

@ -263,7 +263,7 @@ final class Unmarshal {
}
private Character readCharValue() throws IOException {
return new Character(input.readChar());
return Character.valueOf(input.readChar());
}
private String readStringValue() throws IOException {

View file

@ -336,7 +336,7 @@ public class UnoRuntime {
case TypeClass.DOUBLE_value:
return Double.valueOf(0.0);
case TypeClass.CHAR_value:
return new Character('\u0000');
return Character.valueOf('\u0000');
case TypeClass.STRING_value:
return "";
case TypeClass.TYPE_value:

View file

@ -46,7 +46,7 @@ public final class Marshaling_Test {
new com.sun.star.uno.Exception("testException"),
Boolean.TRUE,
Byte.valueOf((byte)47),
new Character('k'),
Character.valueOf('k'),
Double.valueOf(0.12345),
TestEnum.B,
Float.valueOf(0.5678f),

View file

@ -56,7 +56,7 @@ public final class AnyConverter_Test {
@Before public void setUp()
{
aBool= Boolean.TRUE;
aChar= new Character('A');
aChar= Character.valueOf('A');
aByte= Byte.valueOf((byte) 111);
aShort= Short.valueOf((short) 11111);
aInt= Integer.valueOf( 1111111);

View file

@ -1213,7 +1213,7 @@ public class TestComponent {
new Any(Type.UNSIGNED_HYPER, Long.valueOf(-1L)),
Float.valueOf(0.123f),
Double.valueOf(0.456),
new Character('X'),
Character.valueOf('X'),
"test",
Type.ANY,
new Any(Type.BOOLEAN, Boolean.TRUE),
@ -1266,21 +1266,21 @@ public class TestComponent {
new TestPolyStruct(Short.valueOf(Short.MIN_VALUE)),
new TestPolyStruct(Integer.valueOf(Integer.MIN_VALUE)),
new TestPolyStruct(Long.valueOf(Long.MIN_VALUE)),
new TestPolyStruct(new Character('X')),
new TestPolyStruct(Character.valueOf('X')),
new TestPolyStruct("test"),
new TestPolyStruct(Float.valueOf(0.123f)),
new TestPolyStruct(Double.valueOf(0.456)),
new TestPolyStruct(new com.sun.star.lib.uno.helper.ComponentBase()),
new TestPolyStruct(new com.sun.star.lib.uno.helper.ComponentBase()),
new TestPolyStruct(TestEnum.TWO),
new TestPolyStruct(new TestPolyStruct2(new Character('X'),
new TestPolyStruct(new TestPolyStruct2(Character.valueOf('X'),
new Any(Type.BOOLEAN, Boolean.TRUE))),
new TestPolyStruct(new TestPolyStruct2(new TestPolyStruct2(
new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test")),
new TestPolyStruct2("test", new TestPolyStruct2(new Character('X'),
Character.valueOf('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test")),
new TestPolyStruct2("test", new TestPolyStruct2(Character.valueOf('X'),
new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE)))),
new TestPolyStruct2( new TestPolyStruct2(new Character('X'),
new Any(Type.BOOLEAN, Boolean.TRUE)), new TestPolyStruct(new Character('X'))),
new TestPolyStruct2( new TestPolyStruct2(Character.valueOf('X'),
new Any(Type.BOOLEAN, Boolean.TRUE)), new TestPolyStruct(Character.valueOf('X'))),
new TestPolyStruct(new Type[] { Type.LONG}),
new TestPolyStruct(new Any[] { new Any(Type.BOOLEAN, Boolean.TRUE) }),
new TestPolyStruct(new boolean[] {true}),
@ -1296,29 +1296,29 @@ public class TestComponent {
new TestPolyStruct(new com.sun.star.lang.XComponent[] {new com.sun.star.lib.uno.helper.ComponentBase()}),
new TestPolyStruct(new TestEnum[] {TestEnum.TWO}),
new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2(
new Character('X'), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}),
Character.valueOf('X'), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}),
new TestPolyStruct(new TestPolyStruct2[] {new TestPolyStruct2(
new TestPolyStruct(new Character('X')), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}),
new TestPolyStruct(Character.valueOf('X')), new Any[] {new Any(Type.BOOLEAN, Boolean.TRUE)})}),
new TestPolyStruct(new int[][] { new int[] {Integer.MIN_VALUE} }),
new TestPolyStruct[]{ new TestPolyStruct(Integer.valueOf(Integer.MIN_VALUE))},
new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2(
new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))},
Character.valueOf('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))},
new TestPolyStruct[]{new TestPolyStruct(new TestPolyStruct2(
new TestPolyStruct2(new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))},
new TestPolyStruct2(Character.valueOf('X'), new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))},
new TestPolyStruct2[]{new TestPolyStruct2("test", new TestPolyStruct2(
new Character('X'), new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))},
new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2(new Character('X'), new Any(
Type.BOOLEAN, Boolean.TRUE)),new TestPolyStruct(new Character('X')))},
new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(new Character('X'))}},
Character.valueOf('X'), new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))},
new TestPolyStruct2[]{new TestPolyStruct2(new TestPolyStruct2(Character.valueOf('X'), new Any(
Type.BOOLEAN, Boolean.TRUE)),new TestPolyStruct(Character.valueOf('X')))},
new TestPolyStruct[][]{new TestPolyStruct[]{new TestPolyStruct(Character.valueOf('X'))}},
new TestPolyStruct[][]{new TestPolyStruct[]{
new TestPolyStruct(new TestPolyStruct2(new Character('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))}},
new TestPolyStruct(new TestPolyStruct2(Character.valueOf('X'), new Any(Type.BOOLEAN, Boolean.TRUE)))}},
new TestPolyStruct[][]{new TestPolyStruct[] {new TestPolyStruct(new TestPolyStruct2(
new TestPolyStruct2(new Character('X'),new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))}},
new TestPolyStruct2(Character.valueOf('X'),new Any(Type.BOOLEAN, Boolean.TRUE)), "test"))}},
new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2(
"test", new TestPolyStruct2(new Character('X'),new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))}},
"test", new TestPolyStruct2(Character.valueOf('X'),new TestPolyStruct(new Any(Type.BOOLEAN, Boolean.TRUE))))}},
new TestPolyStruct2[][]{new TestPolyStruct2[]{new TestPolyStruct2(
new TestPolyStruct2(new Character('X'),new Any(Type.BOOLEAN, Boolean.TRUE)),
new TestPolyStruct(new Character('X')))}});
new TestPolyStruct2(Character.valueOf('X'),new Any(Type.BOOLEAN, Boolean.TRUE)),
new TestPolyStruct(Character.valueOf('X')))}});
}
public XCurrentContextChecker getCurrentContextChecker() {

View file

@ -179,7 +179,7 @@ public class NumericalHelper
{
case TypeClass.CHAR_value:
aTypeObject.iType = CHAR_TYPE;
aTypeObject.aValue = new Character(AnyConverter.toChar(aValue));
aTypeObject.aValue = Character.valueOf(AnyConverter.toChar(aValue));
break;
case TypeClass.BYTE_value:
aTypeObject.iType = BYTE_TYPE;