diff options
author | Noel Grandin <noel@peralex.com> | 2014-08-12 15:09:06 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-08-19 14:57:17 +0200 |
commit | ff0ad0493ee1729c726587f667761b04101d774c (patch) | |
tree | 8c0f97e8740fbdb2ed0cdbfc5d99d82cae8f7df6 /javaunohelper | |
parent | java: use Boolean.valueOf instead of instantiating Boolean objects (diff) | |
download | core-ff0ad0493ee1729c726587f667761b04101d774c.tar.gz core-ff0ad0493ee1729c726587f667761b04101d774c.zip |
java: use 'Integer.valueOf' instead of 'new Integer'
Change-Id: Ia8befb8d69914ce971174fc5f2ffc0e2f506a940
Diffstat (limited to 'javaunohelper')
3 files changed, 30 insertions, 30 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java index 86d4107072de..327145f624ab 100644 --- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java +++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySet.java @@ -216,7 +216,7 @@ XMultiPropertySet */ protected Property getPropertyByHandle(int nHandle) { - return _handleToPropertyMap.get(new Integer(nHandle)); + return _handleToPropertyMap.get(Integer.valueOf(nHandle)); } /** Returns an array of all Property objects or an array of length null if there @@ -246,7 +246,7 @@ XMultiPropertySet { _nameToPropertyMap.put(prop.Name, prop); if (prop.Handle != -1) - _handleToPropertyMap.put(new Integer(prop.Handle), prop); + _handleToPropertyMap.put(Integer.valueOf(prop.Handle), prop); } /** Assigns an identifyer object to a Property object so that the identifyer @@ -739,7 +739,7 @@ XMultiPropertySet else if (cl.equals(short.class)) retVal= new Short(AnyConverter.toShort(obj)); else if (cl.equals(int.class)) - retVal= new Integer(AnyConverter.toInt(obj)); + retVal= Integer.valueOf(AnyConverter.toInt(obj)); else if (cl.equals(long.class)) retVal= new Long(AnyConverter.toLong(obj)); else if (cl.equals(float.class)) @@ -761,7 +761,7 @@ XMultiPropertySet else if (cl.equals(Short.class)) retVal= new Short(AnyConverter.toShort(obj)); else if (cl.equals(Integer.class)) - retVal= new Integer(AnyConverter.toInt(obj)); + retVal= Integer.valueOf(AnyConverter.toInt(obj)); else if (cl.equals(Long.class)) retVal= new Long(AnyConverter.toLong(obj)); else if (cl.equals(Float.class)) diff --git a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java index 7847a86a26ec..7e2523f2db43 100644 --- a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java +++ b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java @@ -29,12 +29,12 @@ public class ComponentContext_Test { public static void main(String args[]) { try { HashMap<String,Object> table = new HashMap<String,Object>(); - table.put( "bla1", new ComponentContextEntry( null, new Integer( 1 ) ) ); + table.put( "bla1", new ComponentContextEntry( null, Integer.valueOf( 1 ) ) ); XComponentContext xInitialContext = Bootstrap.createInitialComponentContext( table ); table = new HashMap<String,Object>(); - table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) ); - table.put( "bla3", new Integer( 3 ) ); + table.put( "bla2", new ComponentContextEntry( Integer.valueOf( 2 ) ) ); + table.put( "bla3", Integer.valueOf( 3 ) ); XComponentContext xContext = new ComponentContext( table, xInitialContext ); XMultiComponentFactory xSMgr = xContext.getServiceManager(); diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java index 460b55d38b5c..55617e7e038b 100644 --- a/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java +++ b/javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java @@ -113,7 +113,7 @@ public class PropertySet_Test cl.setPropertyValue("PropShortA", value); ret= cl.getPropertyValue("PropShortA"); r[i++]= ((Short) ret).equals(value); - value= new Integer(113); + value= Integer.valueOf(113); cl.setPropertyValue("PropIntA", value); ret= cl.getPropertyValue("PropIntA"); r[i++]= ((Integer) ret).equals(value); @@ -188,7 +188,7 @@ public class PropertySet_Test cl.setPropertyValue("PropObjectA", value); ret= cl.getPropertyValue("PropObjectA"); r[i++]= ((Short) ret).equals(value); - value= new Integer(113); + value= Integer.valueOf(113); cl.setPropertyValue("PropObjectA", value); ret= cl.getPropertyValue("PropObjectA"); r[i++]= ((Integer) ret).equals(value); @@ -245,7 +245,7 @@ public class PropertySet_Test cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); - value= new Integer(113); + value= Integer.valueOf(113); cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); @@ -299,7 +299,7 @@ public class PropertySet_Test cl.setPropertyValue("PropShortA", value); ret= cl.getPropertyValue("PropShortA"); r[i++]= ret instanceof Short && util.anyEquals(value, ret); - value= new Any(new Type(int.class), new Integer(113)); + value= new Any(new Type(int.class), Integer.valueOf(113)); cl.setPropertyValue("PropIntA", value); ret= cl.getPropertyValue("PropIntA"); r[i++]= ret instanceof Integer && util.anyEquals(value, ret); @@ -354,7 +354,7 @@ public class PropertySet_Test cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); - value= new Any(new Type(int.class), new Integer(113)); + value= new Any(new Type(int.class), Integer.valueOf(113)); cl.setPropertyValue("PropAnyA", value); ret= cl.getPropertyValue("PropAnyA"); r[i++]= ret instanceof Any && util.anyEquals(value, ret); @@ -410,7 +410,7 @@ public class PropertySet_Test cl.setPropertyValue("PropShortClass", value); ret= cl.getPropertyValue("PropShortClass"); r[i++]= ((Short) ret).equals(value); - value= new Integer(113); + value= Integer.valueOf(113); cl.setPropertyValue("PropIntClass", value); ret= cl.getPropertyValue("PropIntClass"); r[i++]= ((Integer) ret).equals(value); @@ -446,7 +446,7 @@ public class PropertySet_Test cl.setPropertyValue("PropShortClass", value); ret= cl.getPropertyValue("PropShortClass"); r[i++]= ret instanceof Short && util.anyEquals(value, ret); - value= new Any(new Type(int.class), new Integer(113)); + value= new Any(new Type(int.class), Integer.valueOf(113)); cl.setPropertyValue("PropIntClass", value); ret= cl.getPropertyValue("PropIntClass"); r[i++]= ret instanceof Integer && util.anyEquals(value, ret); @@ -843,10 +843,10 @@ public class PropertySet_Test TestClass cl= new TestClass(); try { - cl.setFastPropertyValue(5, new Integer(111)); + cl.setFastPropertyValue(5, Integer.valueOf(111)); r[i++]= cl.intPropA == 111; try { - cl.setFastPropertyValue(-1, new Integer(1)); i++; + cl.setFastPropertyValue(-1, Integer.valueOf(1)); i++; } catch(UnknownPropertyException e) { r[i++]= true; @@ -874,7 +874,7 @@ public class PropertySet_Test TestClass cl= new TestClass(); try { - cl.setFastPropertyValue(5, new Integer(111)); + cl.setFastPropertyValue(5, Integer.valueOf(111)); Integer aInt= (Integer) cl.getFastPropertyValue(5); r[i++]= aInt.intValue() == 111; }catch(java.lang.Exception e){ @@ -903,7 +903,7 @@ public class PropertySet_Test cl.setPropertyValues(new String[0], new Object[0]); String[] arNames= new String[] {"PropCharA","PropIntClass","PropObjectA"}; Character aChar= new Character('A'); - Integer aInt= new Integer(111); + Integer aInt= Integer.valueOf(111); Byte aByte= new Byte((byte)11); Object[] values= new Object[]{aChar, aInt, aByte}; cl.setPropertyValues(arNames, values); @@ -936,7 +936,7 @@ public class PropertySet_Test TestClass cl= new TestClass(); try { cl.charPropA= 'A'; - cl.intClassProp= new Integer(111); + cl.intClassProp= Integer.valueOf(111); cl.objectPropA= new Byte((byte)11); Object[] values= cl.getPropertyValues(new String[] {"PropCharA","PropIntClass","PropObjectA"}); @@ -1007,7 +1007,7 @@ public class PropertySet_Test TestClass cl= new TestClass(); try { Listener li1= new Listener(); - cl.intClassProp= new Integer(111); + cl.intClassProp= Integer.valueOf(111); cl.charPropA= 'A'; cl.firePropertiesChangeEvent(new String[]{"PropCharA","PropIntClass"}, li1); r[i++]= li1.nPropertiesChange == 1; @@ -1216,7 +1216,7 @@ class TestClass extends PropertySet value= new Short((short) 112); r[i++]= convertPropertyValue(propShortA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Short && outNewVal[0].equals(value); - value= new Integer( 113); + value= Integer.valueOf( 113); r[i++]= convertPropertyValue(propIntA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals(value); value= new Long(114); @@ -1244,13 +1244,13 @@ class TestClass extends PropertySet value= new Object(); // TypeClass.VOID r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value); r[i++]= outNewVal[0].equals(value); - value= new Integer(111); + value= Integer.valueOf(111); r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals(value); value= new ComponentBase(); r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value); r[i++]= outNewVal[0].equals(value); - value= new Integer(111); + value= Integer.valueOf(111); r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Any && ((Any)outNewVal[0]).getType().equals(new Type(Integer.class)) && ((Any)outNewVal[0]).getObject().equals(value); @@ -1271,7 +1271,7 @@ class TestClass extends PropertySet r[i++]= outNewVal[0] instanceof com.sun.star.uno.Enum && outNewVal[0].equals(value); // Any arguments ------------------------------------------------------------------ - value= new Any( new Type(Integer.class),new Integer(111)); + value= new Any( new Type(Integer.class),Integer.valueOf(111)); r[i++]= convertPropertyValue(propIntA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Integer && ((Integer)outNewVal[0]).equals( ((Any)value).getObject()); value= new Any(new Type(Boolean.class), Boolean.TRUE); @@ -1282,7 +1282,7 @@ class TestClass extends PropertySet value= new Any(new Type(Object.class), new Object()); r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value); r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value); - value= new Any(new Type(Integer.class), new Integer(111)); + value= new Any(new Type(Integer.class), Integer.valueOf(111)); r[i++]= convertPropertyValue(propObjectA, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals( ((Any)value).getObject()); r[i++]= convertPropertyValue(propAnyA, outNewVal, outOldVal, value); @@ -1327,7 +1327,7 @@ class TestClass extends PropertySet value= new Short((short) 112); r[i++]= convertPropertyValue(propShortClass, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Short && outNewVal[0].equals(value); - value= new Integer( 113); + value= Integer.valueOf( 113); r[i++]= convertPropertyValue(propIntClass, outNewVal, outOldVal, value); r[i++]= outNewVal[0] instanceof Integer && outNewVal[0].equals(value); value= new Long(114); @@ -1368,7 +1368,7 @@ class TestClass extends PropertySet value= new Short((short) 112); setPropertyValueNoBroadcast(propShortA, value); r[i++]= shortPropA == ((Short) value).shortValue(); - value= new Integer( 113); + value= Integer.valueOf( 113); setPropertyValueNoBroadcast(propIntA, value); r[i++]= intPropA == ((Integer) value).intValue(); value= new Long(114); @@ -1389,13 +1389,13 @@ class TestClass extends PropertySet value= new Type(XInterface.class); setPropertyValueNoBroadcast(propTypeA, value); r[i++]= typePropA.equals(value); - value= new Integer(111); + value= Integer.valueOf(111); setPropertyValueNoBroadcast(propObjectA, value); r[i++]= objectPropA.equals(value); value= new ComponentBase(); setPropertyValueNoBroadcast(propObjectA, value); r[i++]= objectPropA.equals(value); - value= new Any( new Type(Integer.TYPE), new Integer(111)); + value= new Any( new Type(Integer.TYPE), Integer.valueOf(111)); setPropertyValueNoBroadcast(propAnyA, value); r[i++]= util.anyEquals(anyPropA, value); value= new ComponentBase(); @@ -1554,7 +1554,7 @@ class TestClass2 extends PropertySet setPropertyValue("charClassB",val); ret= getPropertyValue("charClassB"); r[i++]= val.equals(ret); - val= new Integer(111); + val= Integer.valueOf(111); setPropertyValue("IntProp",val); ret= getPropertyValue("IntProp"); r[i++]= val.equals(ret); |