From 41d9584179ef7b4e18eda47c2c0a955df8c087a5 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 2 Nov 2023 09:52:08 +0200 Subject: 'new Double' is deprecated in Java replace with Double.valueOf Change-Id: If5be8e500e31ebf9d5fb20ea7dd474677d7c74ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158785 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ridljar/com/sun/star/lib/uno/helper/PropertySet.java | 4 ++-- ridljar/com/sun/star/lib/uno/protocols/urp/Unmarshal.java | 2 +- ridljar/com/sun/star/uno/AnyConverter.java | 8 ++++---- ridljar/com/sun/star/uno/UnoRuntime.java | 2 +- .../test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java | 4 ++-- ridljar/test/com/sun/star/uno/AnyConverter_Test.java | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'ridljar') diff --git a/ridljar/com/sun/star/lib/uno/helper/PropertySet.java b/ridljar/com/sun/star/lib/uno/helper/PropertySet.java index ea89e102b836..2d9fadf5101a 100644 --- a/ridljar/com/sun/star/lib/uno/helper/PropertySet.java +++ b/ridljar/com/sun/star/lib/uno/helper/PropertySet.java @@ -749,7 +749,7 @@ XMultiPropertySet else if (cl.equals(float.class)) retVal= Float.valueOf(AnyConverter.toFloat(obj)); else if (cl.equals(double.class)) - retVal= new Double(AnyConverter.toDouble(obj)); + retVal= Double.valueOf(AnyConverter.toDouble(obj)); else if (cl.equals(String.class)) retVal= AnyConverter.toString(obj); else if (cl.isArray()) @@ -771,7 +771,7 @@ XMultiPropertySet else if (cl.equals(Float.class)) retVal= Float.valueOf(AnyConverter.toFloat(obj)); else if (cl.equals(Double.class)) - retVal= new Double(AnyConverter.toDouble(obj)); + retVal= Double.valueOf(AnyConverter.toDouble(obj)); else if (XInterface.class.isAssignableFrom(cl)) retVal= AnyConverter.toObject(new Type(cl), obj); else if (com.sun.star.uno.Enum.class.isAssignableFrom(cl)) diff --git a/ridljar/com/sun/star/lib/uno/protocols/urp/Unmarshal.java b/ridljar/com/sun/star/lib/uno/protocols/urp/Unmarshal.java index bf820729c2c9..40d5fb3ee02c 100644 --- a/ridljar/com/sun/star/lib/uno/protocols/urp/Unmarshal.java +++ b/ridljar/com/sun/star/lib/uno/protocols/urp/Unmarshal.java @@ -259,7 +259,7 @@ final class Unmarshal { } private Double readDoubleValue() throws IOException { - return new Double(input.readDouble()); + return Double.valueOf(input.readDouble()); } private Character readCharValue() throws IOException { diff --git a/ridljar/com/sun/star/uno/AnyConverter.java b/ridljar/com/sun/star/uno/AnyConverter.java index e44425d71999..b37eab254e76 100644 --- a/ridljar/com/sun/star/uno/AnyConverter.java +++ b/ridljar/com/sun/star/uno/AnyConverter.java @@ -609,13 +609,13 @@ public class AnyConverter case TypeClass.DOUBLE_value: switch (tc) { case TypeClass.BYTE_value: - return new Double( ((Byte)object).byteValue() ); + return Double.valueOf( ((Byte)object).byteValue() ); case TypeClass.SHORT_value: - return new Double( ((Short)object).shortValue() ); + return Double.valueOf( ((Short)object).shortValue() ); case TypeClass.LONG_value: - return new Double( ((Integer)object).intValue() ); + return Double.valueOf( ((Integer)object).intValue() ); case TypeClass.FLOAT_value: - return new Double( ((Float)object).floatValue() ); + return Double.valueOf( ((Float)object).floatValue() ); case TypeClass.DOUBLE_value: return object; } diff --git a/ridljar/com/sun/star/uno/UnoRuntime.java b/ridljar/com/sun/star/uno/UnoRuntime.java index a054b406fe79..d4cf86424907 100644 --- a/ridljar/com/sun/star/uno/UnoRuntime.java +++ b/ridljar/com/sun/star/uno/UnoRuntime.java @@ -334,7 +334,7 @@ public class UnoRuntime { case TypeClass.FLOAT_value: return Float.valueOf(0.0f); case TypeClass.DOUBLE_value: - return new Double(0.0); + return Double.valueOf(0.0); case TypeClass.CHAR_value: return new Character('\u0000'); case TypeClass.STRING_value: diff --git a/ridljar/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java b/ridljar/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java index a1ad705b26a7..6ffc7577d145 100644 --- a/ridljar/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java +++ b/ridljar/test/com/sun/star/lib/uno/protocols/urp/Marshaling_Test.java @@ -38,7 +38,7 @@ public final class Marshaling_Test { TestObject testObject = new TestObject(); TestPrimitiveSeqStruct x = new TestPrimitiveSeqStruct(); - x.zAny = new Object[]{Integer.valueOf(1), new Double(2) }; + x.zAny = new Object[]{Integer.valueOf(1), Double.valueOf(2) }; Object data[] = new Object[] { @@ -47,7 +47,7 @@ public final class Marshaling_Test { Boolean.TRUE, Byte.valueOf((byte)47), new Character('k'), - new Double(0.12345), + Double.valueOf(0.12345), TestEnum.B, Float.valueOf(0.5678f), Integer.valueOf(0), diff --git a/ridljar/test/com/sun/star/uno/AnyConverter_Test.java b/ridljar/test/com/sun/star/uno/AnyConverter_Test.java index 5b1a5b34d4f4..5f045315db08 100644 --- a/ridljar/test/com/sun/star/uno/AnyConverter_Test.java +++ b/ridljar/test/com/sun/star/uno/AnyConverter_Test.java @@ -62,7 +62,7 @@ public final class AnyConverter_Test { aInt= Integer.valueOf( 1111111); aLong= Long.valueOf( 0xffffffff); aFloat= Float.valueOf( 3.14f); - aDouble= new Double( 3.145); + aDouble= Double.valueOf( 3.145); aObj= new ATypeProvider(); aStr= "I am a string"; aType= new Type(String.class); -- cgit