diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-27 15:40:17 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-06-29 22:03:01 +0200 |
commit | b65017a2a7af290f6681da7b197a52efe83d5185 (patch) | |
tree | 06f71a435ba200d044109469b13be7c8f5dbe950 /qadevOOo/runner/lib | |
parent | 33ec740d1438c3dddf8e1974757ed05bb76425ca (diff) |
Java5 update - usage generics where possible
Change-Id: I12f8c448961919e153047e28fee2a0acf3af1002
Diffstat (limited to 'qadevOOo/runner/lib')
-rw-r--r-- | qadevOOo/runner/lib/DynamicClassLoader.java | 10 | ||||
-rw-r--r-- | qadevOOo/runner/lib/MultiMethodTest.java | 6 | ||||
-rw-r--r-- | qadevOOo/runner/lib/Parameters.java | 18 | ||||
-rw-r--r-- | qadevOOo/runner/lib/TestEnvironment.java | 2 | ||||
-rw-r--r-- | qadevOOo/runner/lib/TestResult.java | 6 |
5 files changed, 21 insertions, 21 deletions
diff --git a/qadevOOo/runner/lib/DynamicClassLoader.java b/qadevOOo/runner/lib/DynamicClassLoader.java index 5104350422a0..ef38533bb8f3 100644 --- a/qadevOOo/runner/lib/DynamicClassLoader.java +++ b/qadevOOo/runner/lib/DynamicClassLoader.java @@ -32,7 +32,7 @@ public class DynamicClassLoader { * policy is required for Component and Interface * testing classes. */ - public static Class forName(String className) + public static Class<?> forName(String className) throws ClassNotFoundException { return Class.forName(className) ; @@ -41,7 +41,7 @@ public class DynamicClassLoader { public Object getInstance(String className) throws IllegalArgumentException { try { - Class cls = DynamicClassLoader.forName(className); + Class<?> cls = DynamicClassLoader.forName(className); return cls.newInstance(); } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException("Couldn't find " + className @@ -58,12 +58,12 @@ public class DynamicClassLoader { public Object getInstance(String className, Object[] ctorArgs) throws IllegalArgumentException { try { - Class cls = DynamicClassLoader.forName(className); - Class[] ctorType = new Class[ctorArgs.length]; + Class<?> cls = DynamicClassLoader.forName(className); + Class<?>[] ctorType = new Class[ctorArgs.length]; for(int i=0; i<ctorType.length; i++) { ctorType[i] = ctorArgs[i].getClass(); } - Constructor ctor = cls.getConstructor(ctorType); + Constructor<?> ctor = cls.getConstructor(ctorType); return ctor.newInstance(ctorArgs); } catch ( ClassNotFoundException e ) { throw new IllegalArgumentException("Couldn't find " + className diff --git a/qadevOOo/runner/lib/MultiMethodTest.java b/qadevOOo/runner/lib/MultiMethodTest.java index 004dd448fb74..e2c695671a73 100644 --- a/qadevOOo/runner/lib/MultiMethodTest.java +++ b/qadevOOo/runner/lib/MultiMethodTest.java @@ -97,7 +97,7 @@ public class MultiMethodTest /** * Contains names of the methods have been already called */ - private ArrayList methCalled = new ArrayList(10); + private ArrayList<String> methCalled = new ArrayList<String>(10); /** * Disposes the test environment, which was corrupted by the test. @@ -147,7 +147,7 @@ public class MultiMethodTest // this.log = log; this.entry = entry; this.tRes = new TestResult(); - Class testedClass; + Class<?> testedClass; // Some fake code for a self test. // For normal test we must not be a "ifc.qadevooo._SelfTest" @@ -445,7 +445,7 @@ public class MultiMethodTest mName = mName.substring(0, mName.length() - 2); } - final Class[] paramTypes = new Class[0]; + final Class<?>[] paramTypes = new Class[0]; try { diff --git a/qadevOOo/runner/lib/Parameters.java b/qadevOOo/runner/lib/Parameters.java index 9f0a7e58108d..bd24289ded5a 100644 --- a/qadevOOo/runner/lib/Parameters.java +++ b/qadevOOo/runner/lib/Parameters.java @@ -41,7 +41,7 @@ import com.sun.star.uno.Type; public class Parameters implements XPropertySet { /* final protected Map parameters; final Parameters defaults; */ - final protected Map parameters; + final protected Map<String, Object> parameters; final Parameters defaults; Property[] props; @@ -49,12 +49,12 @@ public class Parameters implements XPropertySet { this (params, null); } - public Parameters(Map params, Parameters defaultParams) { + public Parameters(Map<String, Object> params, Parameters defaultParams) { parameters = params; defaults = defaultParams; checkParameters(parameters); - Set paramSet = new HashSet(parameters.keySet()); + Set<String> paramSet = new HashSet<String>(parameters.keySet()); if (defaults != null) { Set defSet = defaults.toMap().keySet(); @@ -65,8 +65,8 @@ public class Parameters implements XPropertySet { int num = 0; - for (Iterator i = paramSet.iterator(); i.hasNext(); num++) { - String name = (String)i.next(); + for (Iterator<String> i = paramSet.iterator(); i.hasNext(); num++) { + String name = i.next(); props[num] = new Property(name, num, new Type(String.class), (short)0); } @@ -160,8 +160,8 @@ public class Parameters implements XPropertySet { }; } - private static void checkParameters(Map params) { - for (Iterator i = params.keySet().iterator(); i.hasNext();) { + private static void checkParameters(Map<String, Object> params) { + for (Iterator<String> i = params.keySet().iterator(); i.hasNext();) { Object key = i.next(); if (!(key instanceof String)) { @@ -198,8 +198,8 @@ public class Parameters implements XPropertySet { } } - public static Map toMap(XPropertySet props) { - HashMap result = new HashMap(10); + public static Map<String, Object> toMap(XPropertySet props) { + HashMap<String, Object> result = new HashMap<String, Object>(10); XPropertySetInfo setInfo = props.getPropertySetInfo(); Property[] properties = setInfo.getProperties(); diff --git a/qadevOOo/runner/lib/TestEnvironment.java b/qadevOOo/runner/lib/TestEnvironment.java index e88c90e3c0f3..7c9b3d7cbe82 100644 --- a/qadevOOo/runner/lib/TestEnvironment.java +++ b/qadevOOo/runner/lib/TestEnvironment.java @@ -34,7 +34,7 @@ public final class TestEnvironment { * Contains object relations - auxiliary objects associated with the * tested object and required for testing. */ - private final HashMap relations = new HashMap(10); + private final HashMap<String, Object> relations = new HashMap<String, Object>(10); /** * An instance of the tested implementation object. diff --git a/qadevOOo/runner/lib/TestResult.java b/qadevOOo/runner/lib/TestResult.java index e49aaa6224b3..1df57a950d53 100644 --- a/qadevOOo/runner/lib/TestResult.java +++ b/qadevOOo/runner/lib/TestResult.java @@ -27,7 +27,7 @@ public class TestResult { /** * Contains methods having been tested and their results. */ - protected HashMap testedMethods = new HashMap(); + protected HashMap<String, Status> testedMethods = new HashMap<String, Status>(); /** * The method makes method tested with the result, i.e. it adds to its @@ -70,7 +70,7 @@ public class TestResult { * @return methods available in the interface tested. */ public String[] getTestedMethods() { - return (String[])testedMethods.keySet().toArray( + return testedMethods.keySet().toArray( new String[testedMethods.size()]); } @@ -91,7 +91,7 @@ public class TestResult { * @see #assert */ public Status getStatusFor( String method ) { - return (Status)testedMethods.get( method ); + return testedMethods.get( method ); } }
\ No newline at end of file |