summaryrefslogtreecommitdiff
path: root/javaunohelper
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-08-20 17:05:35 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-08-20 19:04:33 +0100
commit8bfe47960f60e1dc2e6bcf0f3c3f7e43dfd3fc0b (patch)
tree12399f5232ff90f000bb58e213629140e564f0ce /javaunohelper
parentf906ac27761332580b769f5f90d1f6bbd7f93701 (diff)
Java5 updates - convert to generics
Change-Id: I039e51958865a7ea000034e7bf765f64d49689cd
Diffstat (limited to 'javaunohelper')
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java2
-rw-r--r--javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java8
-rw-r--r--javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java4
-rw-r--r--javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java4
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java16
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java12
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/PropertySet_Test.java70
-rw-r--r--javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java6
9 files changed, 62 insertions, 62 deletions
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
index 503e970ece19..f575927d2c1e 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/ByteArrayToXInputStreamAdapter.java
@@ -89,7 +89,7 @@ public class ByteArrayToXInputStreamAdapter
// System.err.println("readbytes(..., "+param+")");
_check();
try {
- int remain = (int)(m_length - m_pos);
+ int remain = (m_length - m_pos);
if (param > remain) param = remain;
/* ARGH!!! */
if (values[0] == null){
diff --git a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
index bbd4152f32ef..7c7a3f4445b0 100644
--- a/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
+++ b/javaunohelper/com/sun/star/lib/uno/adapter/InputStreamToXInputStreamAdapter.java
@@ -142,7 +142,7 @@ public class InputStreamToXInputStreamAdapter implements XInputStream {
tmpIntVal = Integer.MAX_VALUE;
} else {
// Casting is safe here.
- tmpIntVal = (int)tmpLongVal;
+ tmpIntVal = tmpLongVal;
}
tmpLongVal -= tmpIntVal;
diff --git a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
index 950840cb0d1c..246dd8639c54 100644
--- a/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
+++ b/javaunohelper/com/sun/star/lib/uno/helper/PropertySetMixin.java
@@ -712,7 +712,7 @@ public final class PropertySetMixin {
throws UnknownPropertyException, PropertyVetoException,
com.sun.star.lang.IllegalArgumentException, WrappedTargetException
{
- PropertyData p = (PropertyData) properties.get(name);
+ PropertyData p = properties.get(name);
if (p == null) {
throw new UnknownPropertyException(name, object);
}
@@ -784,7 +784,7 @@ public final class PropertySetMixin {
Object getProperty(String name, PropertyState[] state)
throws UnknownPropertyException, WrappedTargetException
{
- PropertyData p = (PropertyData) properties.get(name);
+ PropertyData p = properties.get(name);
if (p == null) {
throw new UnknownPropertyException(name, object);
}
@@ -1008,7 +1008,7 @@ public final class PropertySetMixin {
private PropertyData get(Object object, String propertyName)
throws UnknownPropertyException
{
- PropertyData p = (PropertyData) properties.get(propertyName);
+ PropertyData p = properties.get(propertyName);
if (p == null || !p.present) {
throw new UnknownPropertyException(propertyName, object);
}
@@ -1057,7 +1057,7 @@ public final class PropertySetMixin {
}
public boolean hasPropertyByName(String name) {
- PropertyData p = (PropertyData) properties.get(name);
+ PropertyData p = properties.get(name);
return p != null && p.present;
}
diff --git a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
index 19d01c19620d..2a292be96b1a 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/Bootstrap_Test.java
@@ -28,7 +28,7 @@ import com.sun.star.lang.XMultiServiceFactory;
public class Bootstrap_Test {
- static public boolean test( String ini_file, java.util.Hashtable bootstrap_parameters )
+ static public boolean test( String ini_file, java.util.Hashtable<String,String> bootstrap_parameters )
throws java.lang.Exception
{
boolean passed = false;
@@ -91,7 +91,7 @@ public class Bootstrap_Test {
if ( args.length == 0 )
usage();
- java.util.Hashtable bootstrap_parameters = new java.util.Hashtable();
+ java.util.Hashtable<String,String> bootstrap_parameters = new java.util.Hashtable<String,String>();
for ( int nPos = 1; nPos < args.length; ++nPos )
{
String arg = args[ nPos ];
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 7c31d134d79f..1a28a77f84f2 100644
--- a/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java
+++ b/javaunohelper/test/com/sun/star/comp/helper/ComponentContext_Test.java
@@ -31,11 +31,11 @@ import java.util.Hashtable;
public class ComponentContext_Test {
public static void main(String args[]) {
try {
- Hashtable table = new Hashtable();
+ Hashtable<String,Object> table = new Hashtable<String,Object>();
table.put( "bla1", new ComponentContextEntry( null, new Integer( 1 ) ) );
XComponentContext xInitialContext = Bootstrap.createInitialComponentContext( table );
- table = new Hashtable();
+ table = new Hashtable<String,Object>();
table.put( "bla2", new ComponentContextEntry( new Integer( 2 ) ) );
table.put( "bla3", new Integer( 3 ) );
XComponentContext xContext = new ComponentContext( table, xInitialContext );
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
index 84648f51511f..ca5255f03152 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/InterfaceContainer_Test.java
@@ -54,11 +54,11 @@ public class InterfaceContainer_Test
Object proxyObj3TypeProv;
Object proxyObj2TypeProv;
//contains original objects
- List list1;
+ List<Object> list1;
//contains original objects + proxies
- List list2;
+ List<Object> list2;
//contains original object + proxies + null value
- List list3;
+ List<Object> list3;
public InterfaceContainer_Test()
{
@@ -72,15 +72,15 @@ public class InterfaceContainer_Test
proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class);
proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class);
- list1= new ArrayList();
+ list1= new ArrayList<Object>();
list1.add(obj1);
list1.add(obj2);
list1.add(obj3);
- list2= new ArrayList();
+ list2= new ArrayList<Object>();
list2.add(obj1);
list2.add(proxyObj2TypeProv);
list2.add(proxyObj3TypeProv);
- list3= new ArrayList();
+ list3= new ArrayList<Object>();
list3.add(obj1);
list3.add(null);
list3.add(proxyObj2TypeProv);
@@ -368,7 +368,7 @@ public class InterfaceContainer_Test
r[i++]= cont.isEmpty();
cont.addAll(list2);
- List list= new ArrayList();
+ List<Object> list= new ArrayList<Object>();
list.add(list2.get(0));
list.add(list2.get(1));
list.add(proxyObj3Weak2);
@@ -396,7 +396,7 @@ public class InterfaceContainer_Test
cont.addAll(list1); //obj1, obj2, obj3
cont.addAll(list2); //obj1, proxyObj2TypeProv, proxyObj3TypeProv
- List list = new ArrayList();
+ List<Object> list = new ArrayList<Object>();
list.add(obj1);
list.add(proxyObj3Weak1);
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java b/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java
index 1d3fca43a091..12e33a201ee6 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/MultiTypeInterfaceContainer_Test.java
@@ -40,11 +40,11 @@ public class MultiTypeInterfaceContainer_Test
Object proxyObj3TypeProv;
Object proxyObj2TypeProv;
//contains original objects
- List list1;
+ List<Object> list1;
//contains original objects + proxies
- List list2;
+ List<Object> list2;
//contains original object + proxies + null value
- List list3;
+ List<Object> list3;
/** Creates a new instance of MultiTypeInterfaceContainer_Test */
public MultiTypeInterfaceContainer_Test()
@@ -60,15 +60,15 @@ public class MultiTypeInterfaceContainer_Test
proxyObj2TypeProv= ProxyProvider.createProxy(obj2, XTypeProvider.class);
proxyObj3TypeProv= ProxyProvider.createProxy(obj3, XTypeProvider.class);
- list1= new ArrayList();
+ list1= new ArrayList<Object>();
list1.add(obj1);
list1.add(obj2);
list1.add(obj3);
- list2= new ArrayList();
+ list2= new ArrayList<Object>();
list2.add(obj1);
list2.add(proxyObj2TypeProv);
list2.add(proxyObj3TypeProv);
- list3= new ArrayList();
+ list3= new ArrayList<Object>();
list3.add(obj1);
list3.add(null);
list3.add(proxyObj2TypeProv);
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 1992ceb1094a..0dd6fce93ce7 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
@@ -104,47 +104,47 @@ public class PropertySet_Test
value= new Boolean(true);
cl.setPropertyValue("PropBoolA", value);
ret= cl.getPropertyValue("PropBoolA");
- r[i++]= ((Boolean) ret).equals( (Boolean) value);
+ r[i++]= ((Boolean) ret).equals( value);
value= new Character('A');
cl.setPropertyValue("PropCharA",value);
ret= cl.getPropertyValue("PropCharA");
- r[i++]= ((Character) ret).equals((Character) value);
+ r[i++]= ((Character) ret).equals(value);
value= new Byte((byte) 111);
cl.setPropertyValue("PropByteA",value);
ret= cl.getPropertyValue("PropByteA");
- r[i++]= ((Byte) ret).equals((Byte) value);
+ r[i++]= ((Byte) ret).equals(value);
value= new Short((short)112);
cl.setPropertyValue("PropShortA", value);
ret= cl.getPropertyValue("PropShortA");
- r[i++]= ((Short) ret).equals((Short) value);
+ r[i++]= ((Short) ret).equals(value);
value= new Integer(113);
cl.setPropertyValue("PropIntA", value);
ret= cl.getPropertyValue("PropIntA");
- r[i++]= ((Integer) ret).equals((Integer) value);
+ r[i++]= ((Integer) ret).equals(value);
value= new Long(115);
cl.setPropertyValue("PropLongA", value);
ret= cl.getPropertyValue("PropLongA");
- r[i++]= ((Long) ret).equals((Long) value);
+ r[i++]= ((Long) ret).equals(value);
value= new Float(3.14);
cl.setPropertyValue("PropFloatA", value);
ret= cl.getPropertyValue("PropFloatA");
- r[i++]= ((Float) ret).equals((Float) value);
+ r[i++]= ((Float) ret).equals(value);
value= new Double(3.145);
cl.setPropertyValue("PropDoubleA",value);
ret= cl.getPropertyValue("PropDoubleA");
- r[i++]= ((Double) ret).equals((Double) value);
+ r[i++]= ((Double) ret).equals(value);
value= new String("string");
cl.setPropertyValue("PropStringA",value);
ret= cl.getPropertyValue("PropStringA");
- r[i++]= ((String) ret).equals((String) value);
+ r[i++]= ((String) ret).equals(value);
value= new ComponentBase();
cl.setPropertyValue("PropXInterfaceA",value);
ret= cl.getPropertyValue("PropXInterfaceA");
- r[i++]= ((XInterface) ret).equals((XInterface) value);
+ r[i++]= ((XInterface) ret).equals(value);
value= new ComponentBase();
cl.setPropertyValue("PropXWeakA",value);
ret= cl.getPropertyValue("PropXWeakA");
- r[i++]= ((XWeak) ret).equals((XWeak) value);
+ r[i++]= ((XWeak) ret).equals(value);
value = com.sun.star.beans.PropertyState.AMBIGUOUS_VALUE;
cl.setPropertyValue("PropEnum",value);
ret= cl.getPropertyValue("PropEnum");
@@ -152,7 +152,7 @@ public class PropertySet_Test
value= new byte[]{1,2,3};
cl.setPropertyValue("PropArrayByteA", value);
ret= cl.getPropertyValue("PropArrayByteA");
- r[i++]= ((byte[]) ret).equals((byte[]) value);
+ r[i++]= ((byte[]) ret).equals(value);
value= new Type(String.class);
cl.setPropertyValue("PropTypeA", value);
ret= cl.getPropertyValue("PropTypeA");
@@ -162,10 +162,10 @@ public class PropertySet_Test
value= new Boolean(true);
cl.setPropertyValue("PropBoolB", value);
ret= cl.getPropertyValue("PropBoolB");
- r[i++]= ((Boolean) ret).equals((Boolean) value);
+ r[i++]= ((Boolean) ret).equals(value);
cl.setPropertyValue("PropBoolC", value);
ret= cl.getPropertyValue("PropBoolC");
- r[i++]= ((Boolean) ret).equals((Boolean) value);
+ r[i++]= ((Boolean) ret).equals(value);
try{
cl.setPropertyValue("PropBoolD", value);
@@ -179,51 +179,51 @@ public class PropertySet_Test
value= new Boolean(true);
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Boolean) ret).equals((Boolean) value);
+ r[i++]= ((Boolean) ret).equals(value);
value= new Character('A');
cl.setPropertyValue("PropObjectA",value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Character) ret).equals((Character) value);
+ r[i++]= ((Character) ret).equals(value);
value= new Byte((byte) 111);
cl.setPropertyValue("PropObjectA",value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Byte) ret).equals((Byte) value);
+ r[i++]= ((Byte) ret).equals(value);
value= new Short((short)112);
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Short) ret).equals((Short) value);
+ r[i++]= ((Short) ret).equals(value);
value= new Integer(113);
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Integer) ret).equals((Integer) value);
+ r[i++]= ((Integer) ret).equals(value);
value= new Long(115);
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Long) ret).equals((Long) value);
+ r[i++]= ((Long) ret).equals(value);
value= new Float(3.14);
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Float) ret).equals((Float) value);
+ r[i++]= ((Float) ret).equals(value);
value= new Double(3.145);
cl.setPropertyValue("PropObjectA",value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((Double) ret).equals((Double) value);
+ r[i++]= ((Double) ret).equals(value);
value= new String("string");
cl.setPropertyValue("PropObjectA",value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((String) ret).equals((String) value);
+ r[i++]= ((String) ret).equals(value);
value= new ComponentBase();
cl.setPropertyValue("PropObjectA",value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((XInterface) ret).equals((XInterface) value);
+ r[i++]= ((XInterface) ret).equals(value);
value= new ComponentBase();
cl.setPropertyValue("PropObjectA",value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((XWeak) ret).equals((XWeak) value);
+ r[i++]= ((XWeak) ret).equals(value);
value= new byte[]{1,2,3};
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
- r[i++]= ((byte[]) ret).equals((byte[]) value);
+ r[i++]= ((byte[]) ret).equals(value);
value= new Type(String.class);
cl.setPropertyValue("PropObjectA", value);
ret= cl.getPropertyValue("PropObjectA");
@@ -401,35 +401,35 @@ public class PropertySet_Test
value= new Boolean(true);
cl.setPropertyValue("PropBoolClass", value);
ret= cl.getPropertyValue("PropBoolClass");
- r[i++]= ((Boolean) ret).equals( (Boolean) value);
+ r[i++]= ((Boolean) ret).equals( value);
value= new Character('A');
cl.setPropertyValue("PropCharClass",value);
ret= cl.getPropertyValue("PropCharClass");
- r[i++]= ((Character) ret).equals((Character) value);
+ r[i++]= ((Character) ret).equals(value);
value= new Byte((byte) 111);
cl.setPropertyValue("PropByteClass",value);
ret= cl.getPropertyValue("PropByteClass");
- r[i++]= ((Byte) ret).equals((Byte) value);
+ r[i++]= ((Byte) ret).equals(value);
value= new Short((short)112);
cl.setPropertyValue("PropShortClass", value);
ret= cl.getPropertyValue("PropShortClass");
- r[i++]= ((Short) ret).equals((Short) value);
+ r[i++]= ((Short) ret).equals(value);
value= new Integer(113);
cl.setPropertyValue("PropIntClass", value);
ret= cl.getPropertyValue("PropIntClass");
- r[i++]= ((Integer) ret).equals((Integer) value);
+ r[i++]= ((Integer) ret).equals(value);
value= new Long(115);
cl.setPropertyValue("PropLongClass", value);
ret= cl.getPropertyValue("PropLongClass");
- r[i++]= ((Long) ret).equals((Long) value);
+ r[i++]= ((Long) ret).equals(value);
value= new Float(3.14);
cl.setPropertyValue("PropFloatClass", value);
ret= cl.getPropertyValue("PropFloatClass");
- r[i++]= ((Float) ret).equals((Float) value);
+ r[i++]= ((Float) ret).equals(value);
value= new Double(3.145);
cl.setPropertyValue("PropDoubleClass",value);
ret= cl.getPropertyValue("PropDoubleClass");
- r[i++]= ((Double) ret).equals((Double) value);
+ r[i++]= ((Double) ret).equals(value);
cl.resetPropertyMembers();
@@ -1396,7 +1396,7 @@ class TestClass extends PropertySet
value= new Integer(111);
setPropertyValueNoBroadcast(propObjectA, value);
r[i++]= objectPropA.equals(value);
- value= (XInterface) new ComponentBase();
+ value= new ComponentBase();
setPropertyValueNoBroadcast(propObjectA, value);
r[i++]= objectPropA.equals(value);
value= new Any( new Type(Integer.TYPE), new Integer(111));
diff --git a/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java b/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java
index 82d981d6aaa6..e71c6518b756 100644
--- a/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java
+++ b/javaunohelper/test/com/sun/star/lib/uno/helper/UnoUrlTest.java
@@ -123,7 +123,7 @@ public class UnoUrlTest {
assertTrue((url != null));
assertEquals("ABC", url.getRootOid());
assertEquals(1, url.getConnectionParameters().size());
- assertEquals("val9", (String)url.getConnectionParameters().get("key9"));
+ assertEquals("val9", url.getConnectionParameters().get("key9"));
} catch (com.sun.star.lang.IllegalArgumentException e) {
fail(e.getMessage());
}
@@ -176,7 +176,7 @@ public class UnoUrlTest {
assertEquals("StarOffice.ServiceManager", url.getRootOid());
assertEquals("socket", url.getConnection());
assertEquals("urp", url.getProtocol());
- assertEquals("2002", (String)url.getConnectionParameters().get("port"));
+ assertEquals("2002", url.getConnectionParameters().get("port"));
} catch (com.sun.star.lang.IllegalArgumentException e) {
fail("Caught exception:" + e.getMessage());
}
@@ -187,7 +187,7 @@ public class UnoUrlTest {
UnoUrl url =
UnoUrl.parseUnoUrl(
"socket,host=localhost,horst=abc%c3%9c%c3%a4ABC%41%2c%2C,port=2002;urp;StarOffice.ServiceManager");
- assertEquals("abcÜäABCA,,", (String)url.getConnectionParameters().get("horst"));
+ assertEquals("abcÜäABCA,,", url.getConnectionParameters().get("horst"));
assertEquals(
"host=localhost,horst=abc%c3%9c%c3%a4ABC%41%2c%2C,port=2002",
url.getConnectionParametersAsString());