diff options
author | Mark Spruiell <mes@zeroc.com> | 2008-01-30 06:15:20 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2008-01-30 06:15:20 -0800 |
commit | f3c3029ff651d294a1a0df0e79e72771307310fc (patch) | |
tree | 1f061a96f5f46051b6daf45ccbdb63ebd2cdd746 /java | |
parent | Fixed and moved fixVersion.py/fixCopyright.py (diff) | |
download | ice-f3c3029ff651d294a1a0df0e79e72771307310fc.tar.bz2 ice-f3c3029ff651d294a1a0df0e79e72771307310fc.tar.xz ice-f3c3029ff651d294a1a0df0e79e72771307310fc.zip |
using Java5 types in Ice core; general cleanup
Diffstat (limited to 'java')
173 files changed, 1839 insertions, 2199 deletions
diff --git a/java/build.xml b/java/build.xml index 8112a053ed5..5382db373d8 100644 --- a/java/build.xml +++ b/java/build.xml @@ -157,12 +157,11 @@ <mkdir dir="${cache.dir}"/> <depend srcdir="${generated.dir}:${src.dir}" destdir="${lib.dir}" cache="${cache.dir}"/> <javac srcdir="${generated.dir}:${src.dir}" destdir="${lib.dir}" - source="${jdk.version}" debug="${debug}" + source="1.5" debug="${debug}" excludes="IceGridGUI/**" includes="**" deprecation="on"> - <exclude name="Ice/Holder*" if="java2"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> @@ -174,7 +173,7 @@ </jar> </target> - <target name="icegridadmin-compile" depends="ice-compile" if="java2"> + <target name="icegridadmin-compile" depends="ice-compile"> <javac srcdir="${src.dir}" destdir="${lib.dir}" source="1.5" debug="${debug}" includes="IceGridGUI/**" @@ -183,7 +182,6 @@ <condition property="build-icegridadmin-pro-jar"> <and> - <isset property="java2" /> <isset property="hasProguard" /> <available file="${jgoodies.looks}" /> <available file="${jgoodies.forms}" /> @@ -191,12 +189,9 @@ </condition> <condition property="build-icegridadmin-plain-jar"> - <and> - <isset property="java2" /> - <not> - <isset property="build-icegridadmin-pro-jar" /> - </not> - </and> + <not> + <isset property="build-icegridadmin-pro-jar" /> + </not> </condition> <target name="icegridadmin-plain-jar" depends="icegridadmin-compile" if="build-icegridadmin-plain-jar"> diff --git a/java/config/build.properties b/java/config/build.properties index e388fc56a71..89b3d87daa9 100644 --- a/java/config/build.properties +++ b/java/config/build.properties @@ -22,10 +22,9 @@ debug = on ice.version = 3.3 # -# Define lint.unchecked as on if you want to use the Java5 compiler -# option "-Xlint:unchecked". +# Define lint with your preferred -Xlint options. # -#lint.unchecked = on +#lint = unchecked,deprecation # # These properties only need to be set if you want to build the diff --git a/java/config/common.xml b/java/config/common.xml index ebae30c78bc..3656bf4e86f 100644 --- a/java/config/common.xml +++ b/java/config/common.xml @@ -47,25 +47,9 @@ <not><isset property="jdk.version"/></not> </condition> - <!-- Use -Xlint:unchecked when using JDK 1.5 --> - <condition property="javac.lint" value="-Xlint:unchecked" else=""> - <and> - <not> - <isset property="java2"/> - </not> - <istrue value="${lint.unchecked}"/> - </and> - </condition> - - <!-- javac doesn't like an empty argument, so we have to disable the use - of javac.lint when the property is empty --> - <condition property="javac.lint.compiler" value="bogus"> - <equals arg1="${javac.lint}" arg2=""/> - </condition> - <condition property="javac.lint.compiler" value="javac1.5"> - <not> - <equals arg1="${javac.lint}" arg2=""/> - </not> + <!-- Use -Xlint when requested --> + <condition property="javac.lint" value="-Xlint:${lint}" else="-Xlint:none"> + <isset property="lint"/> </condition> <!-- Commonly needed properties --> diff --git a/java/demo/Freeze/bench/build.xml b/java/demo/Freeze/bench/build.xml index 0803522b94f..0c27f052934 100644 --- a/java/demo/Freeze/bench/build.xml +++ b/java/demo/Freeze/bench/build.xml @@ -56,14 +56,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Freeze/casino/build.xml b/java/demo/Freeze/casino/build.xml index c50df895bfa..9a9b6cf5b4c 100644 --- a/java/demo/Freeze/casino/build.xml +++ b/java/demo/Freeze/casino/build.xml @@ -33,14 +33,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Freeze/library/build.xml b/java/demo/Freeze/library/build.xml index 34e9a4a090a..34f2b41d529 100644 --- a/java/demo/Freeze/library/build.xml +++ b/java/demo/Freeze/library/build.xml @@ -43,14 +43,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Freeze/phonebook/build.xml b/java/demo/Freeze/phonebook/build.xml index 69c3e795633..a90696ddc5c 100644 --- a/java/demo/Freeze/phonebook/build.xml +++ b/java/demo/Freeze/phonebook/build.xml @@ -40,14 +40,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Freeze/transform/build.xml b/java/demo/Freeze/transform/build.xml index d496c89a0fb..ec4a9881dfb 100644 --- a/java/demo/Freeze/transform/build.xml +++ b/java/demo/Freeze/transform/build.xml @@ -42,14 +42,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Glacier2/callback/Client.java b/java/demo/Glacier2/callback/Client.java index 985e9f9c1f4..418f5f31af7 100644 --- a/java/demo/Glacier2/callback/Client.java +++ b/java/demo/Glacier2/callback/Client.java @@ -150,7 +150,7 @@ public class Client extends Ice.Application } if(line.equals("t")) { - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); if(override != null) { @@ -160,7 +160,7 @@ public class Client extends Ice.Application } else if(line.equals("o")) { - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "o"); if(override != null) { @@ -170,7 +170,7 @@ public class Client extends Ice.Application } else if(line.equals("O")) { - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "O"); if(override != null) { diff --git a/java/demo/Glacier2/callback/build.xml b/java/demo/Glacier2/callback/build.xml index 48302d39bce..bd57a2ee23a 100644 --- a/java/demo/Glacier2/callback/build.xml +++ b/java/demo/Glacier2/callback/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}" deprecation="on"> + debug="${debug}" deprecation="on"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}" deprecation="on"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/async/HelloI.java b/java/demo/Ice/async/HelloI.java index 8eac890b038..8104075a027 100644 --- a/java/demo/Ice/async/HelloI.java +++ b/java/demo/Ice/async/HelloI.java @@ -36,7 +36,7 @@ public class HelloI extends _HelloDisp { System.out.println("Shutting down..."); - _workQueue.destroy(); + _workQueue._destroy(); current.adapter.getCommunicator().shutdown(); } diff --git a/java/demo/Ice/async/Server.java b/java/demo/Ice/async/Server.java index bb6e446bc6d..32ec6c61c44 100644 --- a/java/demo/Ice/async/Server.java +++ b/java/demo/Ice/async/Server.java @@ -16,7 +16,7 @@ public class Server extends Ice.Application public void run() { - _workQueue.destroy(); + _workQueue._destroy(); communicator().shutdown(); } } diff --git a/java/demo/Ice/async/WorkQueue.java b/java/demo/Ice/async/WorkQueue.java index d7336fbb778..e523330f025 100644 --- a/java/demo/Ice/async/WorkQueue.java +++ b/java/demo/Ice/async/WorkQueue.java @@ -68,10 +68,10 @@ public class WorkQueue extends Thread // // Throw exception for any outstanding requests. // - java.util.Iterator p = _callbacks.iterator(); + java.util.Iterator<CallbackEntry> p = _callbacks.iterator(); while(p.hasNext()) { - CallbackEntry entry = (CallbackEntry)p.next(); + CallbackEntry entry = p.next(); entry.cb.ice_exception(new RequestCanceledException()); } } @@ -104,12 +104,12 @@ public class WorkQueue extends Thread } public synchronized void - destroy() + _destroy() // Thread.destroy is deprecated. { _done = true; notify(); } - private java.util.LinkedList _callbacks = new java.util.LinkedList(); + private java.util.LinkedList<CallbackEntry> _callbacks = new java.util.LinkedList<CallbackEntry>(); private boolean _done = false; } diff --git a/java/demo/Ice/async/build.xml b/java/demo/Ice/async/build.xml index e56523afb4a..a15d757ebee 100644 --- a/java/demo/Ice/async/build.xml +++ b/java/demo/Ice/async/build.xml @@ -32,14 +32,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/bidir/CallbackSenderI.java b/java/demo/Ice/bidir/CallbackSenderI.java index ccce1c4fa4d..332c1c75614 100755 --- a/java/demo/Ice/bidir/CallbackSenderI.java +++ b/java/demo/Ice/bidir/CallbackSenderI.java @@ -32,7 +32,7 @@ class CallbackSenderI extends _CallbackSenderDisp implements java.lang.Runnable Ice.ObjectPrx base = current.con.createProxy(ident); CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(base); - _clients.addElement(client); + _clients.add(client); } public void @@ -41,7 +41,7 @@ class CallbackSenderI extends _CallbackSenderDisp implements java.lang.Runnable int num = 0; while(true) { - java.util.Vector clients; + java.util.List<CallbackReceiverPrx> clients; synchronized(this) { try @@ -51,31 +51,30 @@ class CallbackSenderI extends _CallbackSenderDisp implements java.lang.Runnable catch(java.lang.InterruptedException ex) { } - + if(_destroy) { break; } - - - clients = new java.util.Vector(_clients); + + clients = new java.util.ArrayList<CallbackReceiverPrx>(_clients); } if(!clients.isEmpty()) { ++num; - java.util.Iterator p = clients.iterator(); + java.util.Iterator<CallbackReceiverPrx> p = clients.iterator(); while(p.hasNext()) { - CallbackReceiverPrx r = (CallbackReceiverPrx)p.next(); + CallbackReceiverPrx r = p.next(); try { r.callback(num); } catch(Exception ex) { - System.out.println("removing client `" + _communicator.identityToString(r.ice_getIdentity()) + + System.out.println("removing client `" + _communicator.identityToString(r.ice_getIdentity()) + "':"); ex.printStackTrace(); @@ -91,5 +90,5 @@ class CallbackSenderI extends _CallbackSenderDisp implements java.lang.Runnable private Ice.Communicator _communicator; private boolean _destroy = false; - private java.util.Vector _clients = new java.util.Vector(); + private java.util.List<CallbackReceiverPrx> _clients = new java.util.ArrayList<CallbackReceiverPrx>(); } diff --git a/java/demo/Ice/bidir/build.xml b/java/demo/Ice/bidir/build.xml index e32ad369242..ca217abe522 100755 --- a/java/demo/Ice/bidir/build.xml +++ b/java/demo/Ice/bidir/build.xml @@ -31,13 +31,13 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" source="${jdk.version}" debug="${debug}"> + <javac srcdir="${generated.dir}" destdir="${class.dir}" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" excludes="generated/**" debug="${debug}"> + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/callback/build.xml b/java/demo/Ice/callback/build.xml index c78bee1420e..df254a00f18 100644 --- a/java/demo/Ice/callback/build.xml +++ b/java/demo/Ice/callback/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/hello/build.xml b/java/demo/Ice/hello/build.xml index 751a8bb8ea4..b18621f16a4 100644 --- a/java/demo/Ice/hello/build.xml +++ b/java/demo/Ice/hello/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/invoke/Client.java b/java/demo/Ice/invoke/Client.java index c73eac84b0f..9817c168686 100644 --- a/java/demo/Ice/invoke/Client.java +++ b/java/demo/Ice/invoke/Client.java @@ -123,7 +123,7 @@ public class Client extends Ice.Application // Marshal the in parameter. // Ice.OutputStream out = Ice.Util.createOutputStream(communicator()); - java.util.Map dict = new java.util.HashMap(); + java.util.Map<String, String> dict = new java.util.HashMap<String, String>(); dict.put("The", "streaming"); dict.put("API", "works!"); Demo.StringDictHelper.write(out, dict); diff --git a/java/demo/Ice/invoke/PrinterI.java b/java/demo/Ice/invoke/PrinterI.java index 481f873a510..f7a6b02c8ae 100644 --- a/java/demo/Ice/invoke/PrinterI.java +++ b/java/demo/Ice/invoke/PrinterI.java @@ -45,20 +45,20 @@ public class PrinterI extends Ice.Blobject } else if(current.operation.equals("printDictionary")) { - java.util.Map dict = Demo.StringDictHelper.read(in); + java.util.Map<String, String> dict = Demo.StringDictHelper.read(in); in.destroy(); System.out.print("Printing dictionary {"); - java.util.Iterator i = dict.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, String> > i = dict.entrySet().iterator(); boolean first = true; while(i.hasNext()) { - java.util.Map.Entry e = (java.util.Map.Entry)i.next(); + java.util.Map.Entry<String, String> e = i.next(); if(!first) { System.out.print(", "); } first = false; - System.out.print(e.getKey().toString() + "=" + e.getValue().toString()); + System.out.print(e.getKey() + "=" + e.getValue()); } System.out.println("}"); return true; diff --git a/java/demo/Ice/invoke/build.xml b/java/demo/Ice/invoke/build.xml index 29ec0da3246..c42fa4c8eb7 100644 --- a/java/demo/Ice/invoke/build.xml +++ b/java/demo/Ice/invoke/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/latency/build.xml b/java/demo/Ice/latency/build.xml index 8da020b0106..6c9e24aa9e3 100644 --- a/java/demo/Ice/latency/build.xml +++ b/java/demo/Ice/latency/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/minimal/build.xml b/java/demo/Ice/minimal/build.xml index 07e01f9b2e2..7592eca1991 100644 --- a/java/demo/Ice/minimal/build.xml +++ b/java/demo/Ice/minimal/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/multicast/build.xml b/java/demo/Ice/multicast/build.xml index 734a8b7653f..192dd9f5b06 100644 --- a/java/demo/Ice/multicast/build.xml +++ b/java/demo/Ice/multicast/build.xml @@ -30,14 +30,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/nested/build.xml b/java/demo/Ice/nested/build.xml index f826e5dda97..fd544a6579b 100644 --- a/java/demo/Ice/nested/build.xml +++ b/java/demo/Ice/nested/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/session/Client.java b/java/demo/Ice/session/Client.java index 94abe556799..e880dec4545 100644 --- a/java/demo/Ice/session/Client.java +++ b/java/demo/Ice/session/Client.java @@ -139,7 +139,7 @@ public class Client extends Ice.Application _refresh.start(); } - java.util.ArrayList hellos = new java.util.ArrayList(); + java.util.ArrayList<HelloPrx> hellos = new java.util.ArrayList<HelloPrx>(); menu(); @@ -170,7 +170,7 @@ public class Client extends Ice.Application } if(index < hellos.size()) { - HelloPrx hello = (HelloPrx)hellos.get(index); + HelloPrx hello = hellos.get(index); hello.sayHello(); } else @@ -182,7 +182,7 @@ public class Client extends Ice.Application else if(line.equals("c")) { hellos.add(_session.createHello()); - System.out.println("created hello object " + (hellos.size()-1)); + System.out.println("created hello object " + (hellos.size() - 1)); } else if(line.equals("s")) { diff --git a/java/demo/Ice/session/ReapThread.java b/java/demo/Ice/session/ReapThread.java index 96b8b28b8c7..88ffeeebf4f 100644 --- a/java/demo/Ice/session/ReapThread.java +++ b/java/demo/Ice/session/ReapThread.java @@ -38,10 +38,10 @@ class ReapThread extends Thread if(!_terminated) { - java.util.Iterator p = _sessions.iterator(); + java.util.Iterator<SessionProxyPair> p = _sessions.iterator(); while(p.hasNext()) { - SessionProxyPair s = (SessionProxyPair)p.next(); + SessionProxyPair s = p.next(); try { // @@ -83,5 +83,5 @@ class ReapThread extends Thread private final long _timeout = 10 * 1000; // 10 seconds. private boolean _terminated = false; - private java.util.List _sessions = new java.util.LinkedList(); + private java.util.List<SessionProxyPair> _sessions = new java.util.LinkedList<SessionProxyPair>(); } diff --git a/java/demo/Ice/session/SessionI.java b/java/demo/Ice/session/SessionI.java index 085d0bf2479..85e9c9559d2 100644 --- a/java/demo/Ice/session/SessionI.java +++ b/java/demo/Ice/session/SessionI.java @@ -64,10 +64,10 @@ class SessionI extends _SessionDisp try { c.adapter.remove(c.id); - java.util.Iterator p = _objs.iterator(); + java.util.Iterator<HelloPrx> p = _objs.iterator(); while(p.hasNext()) { - c.adapter.remove(((HelloPrx)p.next()).ice_getIdentity()); + c.adapter.remove(p.next().ice_getIdentity()); } } catch(Ice.ObjectAdapterDeactivatedException e) @@ -92,5 +92,6 @@ class SessionI extends _SessionDisp private boolean _destroy = false; // true if destroy() was called, false otherwise. private long _timestamp; // The last time the session was refreshed. private int _nextId = 0; // The id of the next hello object. This is used for tracing purposes. - private java.util.List _objs = new java.util.LinkedList(); // List of per-client allocated Hello objects. + private java.util.List<HelloPrx> _objs = + new java.util.LinkedList<HelloPrx>(); // List of per-client allocated Hello objects. } diff --git a/java/demo/Ice/session/build.xml b/java/demo/Ice/session/build.xml index 8a54daf0719..b808a375af0 100644 --- a/java/demo/Ice/session/build.xml +++ b/java/demo/Ice/session/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/throughput/build.xml b/java/demo/Ice/throughput/build.xml index a9bf0b5c503..13597eed3c3 100644 --- a/java/demo/Ice/throughput/build.xml +++ b/java/demo/Ice/throughput/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/Ice/value/build.xml b/java/demo/Ice/value/build.xml index 822267675a6..a691fff2f1d 100644 --- a/java/demo/Ice/value/build.xml +++ b/java/demo/Ice/value/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/IceBox/hello/build.xml b/java/demo/IceBox/hello/build.xml index ffd0bc2b35f..09bd4202e7b 100644 --- a/java/demo/IceBox/hello/build.xml +++ b/java/demo/IceBox/hello/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/IceGrid/icebox/build.xml b/java/demo/IceGrid/icebox/build.xml index 7f5b64909af..2152a64f35c 100644 --- a/java/demo/IceGrid/icebox/build.xml +++ b/java/demo/IceGrid/icebox/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/IceGrid/simple/build.xml b/java/demo/IceGrid/simple/build.xml index b74a61f4ef2..0705fc6ef48 100644 --- a/java/demo/IceGrid/simple/build.xml +++ b/java/demo/IceGrid/simple/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/IceStorm/clock/Subscriber.java b/java/demo/IceStorm/clock/Subscriber.java index 3d5bcf98624..047e0e16329 100644 --- a/java/demo/IceStorm/clock/Subscriber.java +++ b/java/demo/IceStorm/clock/Subscriber.java @@ -114,7 +114,7 @@ public class Subscriber extends Ice.Application // // Add a Servant for the Ice Object. // - java.util.Map qos = new java.util.HashMap(); + java.util.Map<String, String> qos = new java.util.HashMap<String, String>(); Ice.ObjectPrx subscriber = adapter.addWithUUID(new ClockI()); // // Set up the proxy. diff --git a/java/demo/IceStorm/clock/build.xml b/java/demo/IceStorm/clock/build.xml index bb2f4d6c749..18de5a55cf9 100644 --- a/java/demo/IceStorm/clock/build.xml +++ b/java/demo/IceStorm/clock/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/book/freeze_filesystem/build.xml b/java/demo/book/freeze_filesystem/build.xml index d5ee4ca7b5b..b2c9993bb02 100644 --- a/java/demo/book/freeze_filesystem/build.xml +++ b/java/demo/book/freeze_filesystem/build.xml @@ -33,14 +33,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/book/lifecycle/FilesystemI/DirectoryI.java b/java/demo/book/lifecycle/FilesystemI/DirectoryI.java index 99d767c800b..d3ebea1d195 100644 --- a/java/demo/book/lifecycle/FilesystemI/DirectoryI.java +++ b/java/demo/book/lifecycle/FilesystemI/DirectoryI.java @@ -53,13 +53,13 @@ public class DirectoryI extends _DirectoryDisp implements NodeI, _DirectoryOpera reap(); NodeDesc[] ret = new NodeDesc[_contents.size()]; - java.util.Iterator pos = _contents.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, NodeI> > pos = _contents.entrySet().iterator(); for(int i = 0; i < _contents.size(); ++i) { - java.util.Map.Entry e = (java.util.Map.Entry)pos.next(); - NodeI p = (NodeI)e.getValue(); + java.util.Map.Entry<String, NodeI> e = pos.next(); + NodeI p = e.getValue(); ret[i] = new NodeDesc(); - ret[i].name = (String)e.getKey(); + ret[i].name = e.getKey(); ret[i].type = p instanceof FileI ? NodeType.FileType : NodeType.DirType; ret[i].proxy = NodePrxHelper.uncheckedCast(c.adapter.createProxy(p.id())); } @@ -198,7 +198,7 @@ public class DirectoryI extends _DirectoryDisp implements NodeI, _DirectoryOpera _parent = parent; _id = new Identity(); _destroyed = false; - _contents = new java.util.HashMap(); + _contents = new java.util.HashMap<String, NodeI>(); if(parent == null) { @@ -225,16 +225,16 @@ public class DirectoryI extends _DirectoryDisp implements NodeI, _DirectoryOpera public void addReapEntry(String name) { - java.util.List l = (java.util.List)_reapMap.get(this); + java.util.List<String> l = _reapMap.get(this); if(l != null) { l.add(name); } else { - java.util.ArrayList v = new java.util.ArrayList(); - v.add(name); - _reapMap.put(this, v); + l = new java.util.ArrayList<String>(); + l.add(name); + _reapMap.put(this, l); } } @@ -243,13 +243,14 @@ public class DirectoryI extends _DirectoryDisp implements NodeI, _DirectoryOpera private static void reap() { - java.util.Iterator i = _reapMap.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<DirectoryI, java.util.List<String> > > i = + _reapMap.entrySet().iterator(); while(i.hasNext()) { - java.util.Map.Entry e = (java.util.Map.Entry)i.next(); - DirectoryI dir = (DirectoryI)e.getKey(); - java.util.List v = (java.util.List)e.getValue(); - java.util.Iterator j = v.iterator(); + java.util.Map.Entry<DirectoryI, java.util.List<String> > e = i.next(); + DirectoryI dir = e.getKey(); + java.util.List<String> l = e.getValue(); + java.util.Iterator<String> j = l.iterator(); while(j.hasNext()) { dir._contents.remove(j.next()); @@ -264,7 +265,8 @@ public class DirectoryI extends _DirectoryDisp implements NodeI, _DirectoryOpera private DirectoryI _parent; // Immutable private Identity _id; // Immutable private boolean _destroyed; - private java.util.Map _contents; + private java.util.Map<String, NodeI> _contents; - private static java.util.Map _reapMap = new java.util.HashMap(); + private static java.util.Map<DirectoryI, java.util.List<String> > _reapMap = + new java.util.HashMap<DirectoryI, java.util.List<String> >(); } diff --git a/java/demo/book/lifecycle/Grammar.java b/java/demo/book/lifecycle/Grammar.java index 1bef5606464..92da79a56d0 100644 --- a/java/demo/book/lifecycle/Grammar.java +++ b/java/demo/book/lifecycle/Grammar.java @@ -69,7 +69,7 @@ class Grammar } else if(_token.type == Token.TOK_CREATE_FILE) { - java.util.List s = strings(); + java.util.List<String> s = strings(); if(_token.type != Token.TOK_SEMI) { throw new ParseError("Expected ';'"); @@ -82,7 +82,7 @@ class Grammar } else if(_token.type == Token.TOK_CREATE_DIR) { - java.util.List s = strings(); + java.util.List<String> s = strings(); if(_token.type != Token.TOK_SEMI) { throw new ParseError("Expected ';'"); @@ -104,7 +104,7 @@ class Grammar } else if(_token.type == Token.TOK_CD) { - java.util.List s = strings(); + java.util.List<String> s = strings(); if(_token.type != Token.TOK_SEMI) { throw new ParseError("Expected ';'"); @@ -124,7 +124,7 @@ class Grammar } else if(_token.type == Token.TOK_CAT) { - java.util.List s = strings(); + java.util.List<String> s = strings(); if(_token.type != Token.TOK_SEMI) { throw new ParseError("Expected ';'"); @@ -137,7 +137,7 @@ class Grammar } else if(_token.type == Token.TOK_WRITE) { - java.util.LinkedList s = strings(); + java.util.LinkedList<String> s = strings(); if(_token.type != Token.TOK_SEMI) { throw new ParseError("Expected ';'"); @@ -150,7 +150,7 @@ class Grammar } else if(_token.type == Token.TOK_RM) { - java.util.List s = strings(); + java.util.List<String> s = strings(); if(_token.type != Token.TOK_SEMI) { throw new ParseError("Expected ';'"); @@ -173,10 +173,10 @@ class Grammar } } - private java.util.LinkedList + private java.util.LinkedList<String> strings() { - java.util.LinkedList l = new java.util.LinkedList(); + java.util.LinkedList<String> l = new java.util.LinkedList<String>(); while(true) { _token = _scanner.nextToken(); diff --git a/java/demo/book/lifecycle/Parser.java b/java/demo/book/lifecycle/Parser.java index 402ddfd51d6..94e4af53654 100644 --- a/java/demo/book/lifecycle/Parser.java +++ b/java/demo/book/lifecycle/Parser.java @@ -13,7 +13,7 @@ class Parser { Parser(DirectoryPrx root) { - _dirs = new java.util.LinkedList(); + _dirs = new java.util.LinkedList<DirectoryPrx>(); _dirs.addFirst(root); } @@ -39,7 +39,7 @@ class Parser { try { - list((DirectoryPrx)_dirs.get(0), recursive, 0); + list(_dirs.get(0), recursive, 0); } catch(Ice.LocalException ex) { @@ -79,14 +79,14 @@ class Parser } void - createFile(java.util.List names) + createFile(java.util.List<String> names) { - DirectoryPrx dir = (DirectoryPrx)_dirs.getFirst(); + DirectoryPrx dir = _dirs.getFirst(); - java.util.Iterator i = names.iterator(); + java.util.Iterator<String> i = names.iterator(); while(i.hasNext()) { - String name = (String)i.next(); + String name = i.next(); if(name.equals("..")) { System.out.println("Cannot create a file named `..'"); @@ -105,14 +105,14 @@ class Parser } void - createDir(java.util.List names) + createDir(java.util.List<String> names) { - DirectoryPrx dir = (DirectoryPrx)_dirs.getFirst(); + DirectoryPrx dir = _dirs.getFirst(); - java.util.Iterator i = names.iterator(); + java.util.Iterator<String> i = names.iterator(); while(i.hasNext()) { - String name = (String)i.next(); + String name = i.next(); if(name.equals("..")) { System.out.println("Cannot create a directory named `..'"); @@ -139,11 +139,11 @@ class Parser } else { - java.util.ListIterator i = _dirs.listIterator(_dirs.size()); + java.util.ListIterator<DirectoryPrx> i = _dirs.listIterator(_dirs.size()); i.previous(); while(i.hasPrevious()) { - System.out.print("/" + (String)(((DirectoryPrx)i.previous()).name())); + System.out.print("/" + i.previous().name()); } } System.out.println(); @@ -170,7 +170,7 @@ class Parser return; } - DirectoryPrx dir = (DirectoryPrx)_dirs.getFirst(); + DirectoryPrx dir = _dirs.getFirst(); NodeDesc d; try { @@ -192,7 +192,7 @@ class Parser void cat(String name) { - DirectoryPrx dir = (DirectoryPrx)_dirs.getFirst(); + DirectoryPrx dir = _dirs.getFirst(); NodeDesc d; try { @@ -217,10 +217,10 @@ class Parser } void - write(java.util.LinkedList args) + write(java.util.LinkedList<String> args) { - DirectoryPrx dir = (DirectoryPrx)_dirs.getFirst(); - String name = (String)args.getFirst(); + DirectoryPrx dir = _dirs.getFirst(); + String name = args.getFirst(); args.removeFirst(); NodeDesc d; try @@ -240,10 +240,10 @@ class Parser FilePrx f = FilePrxHelper.uncheckedCast(d.proxy); String[] l = new String[args.size()]; - java.util.Iterator i = args.iterator(); + java.util.Iterator<String> i = args.iterator(); for(int j = 0; j < args.size(); ++j) { - l[j] = (String)i.next(); + l[j] = i.next(); } try { @@ -256,14 +256,14 @@ class Parser } void - destroy(java.util.List names) + destroy(java.util.List<String> names) { - DirectoryPrx dir = (DirectoryPrx)_dirs.getFirst(); + DirectoryPrx dir = _dirs.getFirst(); - java.util.Iterator i = names.iterator(); + java.util.Iterator<String> i = names.iterator(); while(i.hasNext()) { - String name = (String)i.next(); + String name = i.next(); if(name.equals("*")) { NodeDesc[] nodes = dir.list(); @@ -355,7 +355,7 @@ class Parser return 0; } - private java.util.LinkedList _dirs; + private java.util.LinkedList<DirectoryPrx> _dirs; private java.io.BufferedReader _in; } diff --git a/java/demo/book/lifecycle/build.xml b/java/demo/book/lifecycle/build.xml index b5bddaaebd5..8a6f3b863e3 100644 --- a/java/demo/book/lifecycle/build.xml +++ b/java/demo/book/lifecycle/build.xml @@ -32,14 +32,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/book/printer/build.xml b/java/demo/book/printer/build.xml index dd68451208b..bae3f66e824 100755 --- a/java/demo/book/printer/build.xml +++ b/java/demo/book/printer/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/demo/book/simple_filesystem/Filesystem/DirectoryI.java b/java/demo/book/simple_filesystem/Filesystem/DirectoryI.java index e8db9d699de..b66c72f1d93 100755 --- a/java/demo/book/simple_filesystem/Filesystem/DirectoryI.java +++ b/java/demo/book/simple_filesystem/Filesystem/DirectoryI.java @@ -65,5 +65,5 @@ public final class DirectoryI extends _DirectoryDisp public static Ice.ObjectAdapter _adapter; private String _name; private DirectoryI _parent; - private java.util.ArrayList _contents = new java.util.ArrayList(); + private java.util.List<NodePrx> _contents = new java.util.ArrayList<NodePrx>(); } diff --git a/java/demo/book/simple_filesystem/build.xml b/java/demo/book/simple_filesystem/build.xml index 7005388e4ea..0aeab2be8ea 100755 --- a/java/demo/book/simple_filesystem/build.xml +++ b/java/demo/book/simple_filesystem/build.xml @@ -29,14 +29,14 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" debug="${debug}"> + debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" excludes="generated/**" debug="${debug}"> <classpath refid="ice.classpath"/> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index f62be52b497..de67944b223 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -1131,28 +1131,28 @@ public final class ConnectionI extends IceInternal.EventHandler finishStart(_exception); - java.util.Iterator i = _queuedStreams.iterator(); - while(i.hasNext()) + java.util.Iterator<OutgoingMessage> p = _queuedStreams.iterator(); + while(p.hasNext()) { - OutgoingMessage message = (OutgoingMessage)i.next(); + OutgoingMessage message = p.next(); message.finished(_exception); } _queuedStreams.clear(); - i = _requests.entryIterator(); // _requests is immutable at this point. - while(i.hasNext()) + java.util.Iterator<IceInternal.Outgoing> q = + _requests.values().iterator(); // _requests is immutable at this point. + while(q.hasNext()) { - IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next(); - IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue(); + IceInternal.Outgoing out = q.next(); out.finished(_exception); // The exception is immutable at this point. } _requests.clear(); - i = _asyncRequests.entryIterator(); // _asyncRequests is immutable at this point. - while(i.hasNext()) + java.util.Iterator<IceInternal.OutgoingAsync> r = + _asyncRequests.values().iterator(); // _asyncRequests is immutable at this point. + while(r.hasNext()) { - IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next(); - IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue(); + IceInternal.OutgoingAsync out = r.next(); out.__finished(_exception); // The exception is immutable at this point. } _asyncRequests.clear(); @@ -1326,7 +1326,7 @@ public final class ConnectionI extends IceInternal.EventHandler } else { - java.util.LinkedList streams = _queuedStreams; + java.util.LinkedList<OutgoingMessage> streams = _queuedStreams; _queuedStreams = _sendStreams; _sendStreams = streams; return IceInternal.SocketStatus.NeedWrite; // We're not finished yet, there's more data to send! @@ -1964,7 +1964,7 @@ public final class ConnectionI extends IceInternal.EventHandler while(!_sendStreams.isEmpty()) { - OutgoingMessage message = (OutgoingMessage)_sendStreams.getFirst(); + OutgoingMessage message = _sendStreams.getFirst(); if(!message.prepared) { IceInternal.BasicStream stream = message.stream; @@ -2288,14 +2288,14 @@ public final class ConnectionI extends IceInternal.EventHandler { IceInternal.TraceUtil.traceRecv(info.stream, _logger, _traceLevels); info.requestId = info.stream.readInt(); - IceInternal.Outgoing out = (IceInternal.Outgoing)_requests.remove(info.requestId); + IceInternal.Outgoing out = _requests.remove(info.requestId); if(out != null) { out.finished(info.stream); } else { - info.outAsync = (IceInternal.OutgoingAsync)_asyncRequests.remove(info.requestId); + info.outAsync = _asyncRequests.remove(info.requestId); if(info.outAsync == null) { throw new UnknownRequestIdException(); @@ -2668,28 +2668,26 @@ public final class ConnectionI extends IceInternal.EventHandler if(closed) { - java.util.Iterator i = _queuedStreams.iterator(); - while(i.hasNext()) + java.util.Iterator<OutgoingMessage> p = _queuedStreams.iterator(); + while(p.hasNext()) { - OutgoingMessage message = (OutgoingMessage)i.next(); + OutgoingMessage message = p.next(); message.finished(_exception); } _queuedStreams.clear(); - i = _requests.entryIterator(); - while(i.hasNext()) + java.util.Iterator<IceInternal.Outgoing> q = _requests.values().iterator(); + while(q.hasNext()) { - IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next(); - IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue(); + IceInternal.Outgoing out = q.next(); out.finished(_exception); // The exception is immutable at this point. } _requests.clear(); - i = _asyncRequests.entryIterator(); - while(i.hasNext()) + java.util.Iterator<IceInternal.OutgoingAsync> r = _asyncRequests.values().iterator(); + while(r.hasNext()) { - IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.next(); - IceInternal.OutgoingAsync out = (IceInternal.OutgoingAsync)e.getValue(); + IceInternal.OutgoingAsync out = r.next(); out.__finished(_exception); // The exception is immutable at this point. } _asyncRequests.clear(); @@ -2778,7 +2776,8 @@ public final class ConnectionI extends IceInternal.EventHandler } public IceInternal.Outgoing - getOutgoing(IceInternal.RequestHandler handler, String operation, OperationMode mode, java.util.Map context) + getOutgoing(IceInternal.RequestHandler handler, String operation, OperationMode mode, + java.util.Map<String, String> context) throws IceInternal.LocalExceptionWrapper { IceInternal.Outgoing out = null; @@ -2968,8 +2967,10 @@ public final class ConnectionI extends IceInternal.EventHandler private int _nextRequestId; - private IceInternal.IntMap _requests = new IceInternal.IntMap(); - private IceInternal.IntMap _asyncRequests = new IceInternal.IntMap(); + private java.util.Map<Integer, IceInternal.Outgoing> _requests = + new java.util.HashMap<Integer, IceInternal.Outgoing>(); + private java.util.Map<Integer, IceInternal.OutgoingAsync> _asyncRequests = + new java.util.HashMap<Integer, IceInternal.OutgoingAsync>(); private LocalException _exception; @@ -2980,8 +2981,8 @@ public final class ConnectionI extends IceInternal.EventHandler private boolean _batchRequestCompress; private int _batchMarker; - private java.util.LinkedList _queuedStreams = new java.util.LinkedList(); - private java.util.LinkedList _sendStreams = new java.util.LinkedList(); + private java.util.LinkedList<OutgoingMessage> _queuedStreams = new java.util.LinkedList<OutgoingMessage>(); + private java.util.LinkedList<OutgoingMessage> _sendStreams = new java.util.LinkedList<OutgoingMessage>(); private boolean _sendInProgress; private int _dispatchCount; diff --git a/java/src/Ice/ImplicitContextI.java b/java/src/Ice/ImplicitContextI.java index 7f3a7a91f9d..036dfbf4627 100644 --- a/java/src/Ice/ImplicitContextI.java +++ b/java/src/Ice/ImplicitContextI.java @@ -31,21 +31,20 @@ public abstract class ImplicitContextI implements ImplicitContext else { throw new Ice.InitializationException( - "'" + kind + "' is not a valid value for Ice.ImplicitContext"); + "'" + kind + "' is not a valid value for Ice.ImplicitContext"); } } - abstract public void write(java.util.Map prxContext, IceInternal.BasicStream os); - abstract java.util.Map combine(java.util.Map prxContext); - + abstract public void write(java.util.Map<String, String> prxContext, IceInternal.BasicStream os); + abstract java.util.Map<String, String> combine(java.util.Map<String, String> prxContext); static class Shared extends ImplicitContextI { public synchronized java.util.Map getContext() { - return (java.util.Map)_context.clone(); + return new java.util.HashMap<String, String>(_context); } - + public synchronized void setContext(java.util.Map context) { _context.clear(); @@ -54,7 +53,7 @@ public abstract class ImplicitContextI implements ImplicitContext _context.putAll(context); } } - + public synchronized boolean containsKey(String key) { if(key == null) @@ -72,12 +71,12 @@ public abstract class ImplicitContextI implements ImplicitContext key = ""; } - String val = (String)_context.get(key); + String val = _context.get(key); if(val == null) { val = ""; } - + return val; } @@ -92,7 +91,7 @@ public abstract class ImplicitContextI implements ImplicitContext value = ""; } - String oldVal = (String)_context.put(key, value); + String oldVal = _context.put(key, value); if(oldVal == null) { oldVal = ""; @@ -107,7 +106,7 @@ public abstract class ImplicitContextI implements ImplicitContext key = ""; } - String val = (String)_context.remove(key); + String val = _context.remove(key); if(val == null) { @@ -116,7 +115,7 @@ public abstract class ImplicitContextI implements ImplicitContext return val; } - public void write(java.util.Map prxContext, IceInternal.BasicStream os) + public void write(java.util.Map<String, String> prxContext, IceInternal.BasicStream os) { if(prxContext.isEmpty()) { @@ -125,40 +124,40 @@ public abstract class ImplicitContextI implements ImplicitContext ContextHelper.write(os, _context); } } - else + else { - java.util.Map ctx = null; + java.util.Map<String, String> ctx = null; synchronized(this) { - ctx = _context.isEmpty() ? prxContext : combine(prxContext); + ctx = _context.isEmpty() ? prxContext : combine(prxContext); } ContextHelper.write(os, ctx); } } - synchronized java.util.Map combine(java.util.Map prxContext) + synchronized java.util.Map<String, String> combine(java.util.Map<String, String> prxContext) { - java.util.Map combined = (java.util.Map)_context.clone(); + java.util.Map<String, String> combined = new java.util.HashMap<String, String>(_context); combined.putAll(prxContext); return combined; } - private java.util.HashMap _context = new java.util.HashMap(); + private java.util.Map<String, String> _context = new java.util.HashMap<String, String>(); } static class PerThread extends ImplicitContextI { - + public java.util.Map getContext() { // // Note that _map is a *synchronized* map // - java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread()); - + java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); + if(threadContext == null) { - threadContext = new java.util.HashMap(); + threadContext = new java.util.HashMap<String, String>(); } return threadContext; } @@ -171,7 +170,7 @@ public abstract class ImplicitContextI implements ImplicitContext } else { - java.util.HashMap threadContext = new java.util.HashMap(context); + java.util.Map<String, String> threadContext = new java.util.HashMap<String, String>(context); _map.put(Thread.currentThread(), threadContext); } } @@ -183,7 +182,7 @@ public abstract class ImplicitContextI implements ImplicitContext key = ""; } - java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread()); + java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); if(threadContext == null) { @@ -200,13 +199,13 @@ public abstract class ImplicitContextI implements ImplicitContext key = ""; } - java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread()); + java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); if(threadContext == null) { return ""; } - String val = (String)threadContext.get(key); + String val = threadContext.get(key); if(val == null) { val = ""; @@ -226,15 +225,15 @@ public abstract class ImplicitContextI implements ImplicitContext } Thread currentThread = Thread.currentThread(); - java.util.HashMap threadContext = (java.util.HashMap)_map.get(currentThread); + java.util.Map<String, String> threadContext = _map.get(currentThread); if(threadContext == null) { - threadContext = new java.util.HashMap(); + threadContext = new java.util.HashMap<String, String>(); _map.put(currentThread, threadContext); } - - String oldVal = (String)threadContext.put(key, value); + + String oldVal = threadContext.put(key, value); if(oldVal == null) { oldVal = ""; @@ -249,14 +248,14 @@ public abstract class ImplicitContextI implements ImplicitContext key = ""; } - java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread()); + java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); if(threadContext == null) { return null; } - String val = (String)threadContext.remove(key); + String val = threadContext.remove(key); if(val == null) { @@ -265,10 +264,10 @@ public abstract class ImplicitContextI implements ImplicitContext return val; } - public void write(java.util.Map prxContext, IceInternal.BasicStream os) + public void write(java.util.Map<String, String> prxContext, IceInternal.BasicStream os) { - java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread()); - + java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); + if(threadContext == null || threadContext.isEmpty()) { ContextHelper.write(os, prxContext); @@ -279,17 +278,17 @@ public abstract class ImplicitContextI implements ImplicitContext } else { - java.util.Map combined = (java.util.Map)threadContext.clone(); + java.util.Map<String, String> combined = new java.util.HashMap<String, String>(threadContext); combined.putAll(prxContext); ContextHelper.write(os, combined); } } - java.util.Map combine(java.util.Map prxContext) + java.util.Map<String, String> combine(java.util.Map<String, String> prxContext) { - java.util.HashMap threadContext = (java.util.HashMap)_map.get(Thread.currentThread()); + java.util.Map<String, String> threadContext = _map.get(Thread.currentThread()); - java.util.Map combined = (java.util.Map)threadContext.clone(); + java.util.Map<String, String> combined = new java.util.HashMap<String, String>(threadContext); combined.putAll(prxContext); return combined; } @@ -297,7 +296,7 @@ public abstract class ImplicitContextI implements ImplicitContext // // Synchronized map Thread -> Context // - private java.util.Map _map = java.util.Collections.synchronizedMap(new java.util.HashMap()); - - } + private java.util.Map<Thread, java.util.Map<String, String> > _map = + java.util.Collections.synchronizedMap(new java.util.HashMap<Thread, java.util.Map<String, String> >()); + } } diff --git a/java/src/Ice/ObjectAdapterI.java b/java/src/Ice/ObjectAdapterI.java index d8e10e68f2e..6998793fa06 100644 --- a/java/src/Ice/ObjectAdapterI.java +++ b/java/src/Ice/ObjectAdapterI.java @@ -24,7 +24,7 @@ public final class ObjectAdapterI implements ObjectAdapter getCommunicator() { checkForDeactivation(); - + return _communicator; } @@ -38,7 +38,7 @@ public final class ObjectAdapterI implements ObjectAdapter synchronized(this) { checkForDeactivation(); - + // // If the one off initializations of the adapter are already // done, we just need to activate the incoming connection @@ -64,7 +64,7 @@ public final class ObjectAdapterI implements ObjectAdapter // initializations are done. // _waitForActivate = true; - + locatorInfo = _locatorInfo; if(!_noConfig) { @@ -104,7 +104,7 @@ public final class ObjectAdapterI implements ObjectAdapter synchronized(this) { assert(!_deactivated); // Not possible if _waitForActivate = true; - + // // Signal threads waiting for the activation. // @@ -112,7 +112,7 @@ public final class ObjectAdapterI implements ObjectAdapter notifyAll(); _activateOneOffDone = true; - + final int sz = _incomingConnectionFactories.size(); for(int i = 0; i < sz; ++i) { @@ -127,7 +127,7 @@ public final class ObjectAdapterI implements ObjectAdapter hold() { checkForDeactivation(); - + final int sz = _incomingConnectionFactories.size(); for(int i = 0; i < sz; ++i) { @@ -155,7 +155,7 @@ public final class ObjectAdapterI implements ObjectAdapter deactivate() { IceInternal.OutgoingConnectionFactory outgoingConnectionFactory; - java.util.ArrayList incomingConnectionFactories; + java.util.List<IceInternal.IncomingConnectionFactory> incomingConnectionFactories; IceInternal.LocatorInfo locatorInfo; synchronized(this) { @@ -196,13 +196,14 @@ public final class ObjectAdapterI implements ObjectAdapter // _routerInfo.setAdapter(null); } - - incomingConnectionFactories = new java.util.ArrayList(_incomingConnectionFactories); + + incomingConnectionFactories = + new java.util.ArrayList<IceInternal.IncomingConnectionFactory>(_incomingConnectionFactories); outgoingConnectionFactory = _instance.outgoingConnectionFactory(); locatorInfo = _locatorInfo; _deactivated = true; - + notifyAll(); } @@ -226,8 +227,7 @@ public final class ObjectAdapterI implements ObjectAdapter final int sz = incomingConnectionFactories.size(); for(int i = 0; i < sz; ++i) { - IceInternal.IncomingConnectionFactory factory = - (IceInternal.IncomingConnectionFactory)incomingConnectionFactories.get(i); + IceInternal.IncomingConnectionFactory factory = incomingConnectionFactories.get(i); factory.destroy(); } @@ -266,12 +266,12 @@ public final class ObjectAdapterI implements ObjectAdapter { } } - + incomingConnectionFactories = (IceInternal.IncomingConnectionFactory[])_incomingConnectionFactories.toArray( new IceInternal.IncomingConnectionFactory[0]); } - + // // Now we wait for until all incoming connection factories are // finished. @@ -330,7 +330,7 @@ public final class ObjectAdapterI implements ObjectAdapter // locators. // _servantManager.destroy(); - + // // Destroy the thread pool. // @@ -359,7 +359,7 @@ public final class ObjectAdapterI implements ObjectAdapter // to null so that the finalizer does not invoke methods on objects. // _incomingConnectionFactories = null; - + // // Remove object references (some of them cyclic). // @@ -393,7 +393,7 @@ public final class ObjectAdapterI implements ObjectAdapter { checkForDeactivation(); checkIdentity(ident); - + // // Create a copy of the Identity argument, in case the caller // reuses it. @@ -536,7 +536,7 @@ public final class ObjectAdapterI implements ObjectAdapter { IceInternal.LocatorInfo locatorInfo = null; boolean registerProcess = false; - java.util.ArrayList oldPublishedEndpoints; + java.util.List<IceInternal.EndpointI> oldPublishedEndpoints; synchronized(this) { @@ -579,7 +579,7 @@ public final class ObjectAdapterI implements ObjectAdapter // NOTE: it's important that isLocal() doesn't perform any blocking operations as // it can be called for AMI invocations if the proxy has no delegate set yet. // - + IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference(); if(ref.isWellKnown()) { @@ -604,7 +604,7 @@ public final class ObjectAdapterI implements ObjectAdapter synchronized(this) { checkForDeactivation(); - + // // Proxies which have at least one endpoint in common with the // endpoints used by this object adapter's incoming connection @@ -612,26 +612,26 @@ public final class ObjectAdapterI implements ObjectAdapter // for(int i = 0; i < endpoints.length; ++i) { - java.util.Iterator p; - p = _publishedEndpoints.iterator(); + java.util.Iterator<IceInternal.EndpointI> p = _publishedEndpoints.iterator(); while(p.hasNext()) { - if(endpoints[i].equivalent((IceInternal.EndpointI)p.next())) + if(endpoints[i].equivalent(p.next())) { return true; } } - p = _incomingConnectionFactories.iterator(); - while(p.hasNext()) + java.util.Iterator<IceInternal.IncomingConnectionFactory> q = + _incomingConnectionFactories.iterator(); + while(q.hasNext()) { - if(endpoints[i].equivalent(((IceInternal.IncomingConnectionFactory)p.next()).endpoint())) + if(endpoints[i].equivalent(q.next().endpoint())) { return true; } } - + } - + // // Proxies which have at least one endpoint in common with the // router's server proxy endpoints (if any), are also considered @@ -641,11 +641,10 @@ public final class ObjectAdapterI implements ObjectAdapter { for(int i = 0; i < endpoints.length; ++i) { - java.util.Iterator p; - p = _routerEndpoints.iterator(); + java.util.Iterator<IceInternal.EndpointI> p = _routerEndpoints.iterator(); while(p.hasNext()) { - if(endpoints[i].equivalent((IceInternal.EndpointI)p.next())) + if(endpoints[i].equivalent(p.next())) { return true; } @@ -661,15 +660,15 @@ public final class ObjectAdapterI implements ObjectAdapter public void flushBatchRequests() { - java.util.ArrayList f; + java.util.List<IceInternal.IncomingConnectionFactory> f; synchronized(this) { - f = new java.util.ArrayList(_incomingConnectionFactories); + f = new java.util.ArrayList<IceInternal.IncomingConnectionFactory>(_incomingConnectionFactories); } - java.util.Iterator i = f.iterator(); + java.util.Iterator<IceInternal.IncomingConnectionFactory> i = f.iterator(); while(i.hasNext()) { - ((IceInternal.IncomingConnectionFactory)i.next()).flushBatchRequests(); + i.next().flushBatchRequests(); } } @@ -686,9 +685,9 @@ public final class ObjectAdapterI implements ObjectAdapter decDirectCount() { // Not check for deactivation here! - + assert(_instance != null); // Must not be called after destroy(). - + assert(_directCount > 0); if(--_directCount == 0) { @@ -702,9 +701,9 @@ public final class ObjectAdapterI implements ObjectAdapter // No mutex lock necessary, _threadPool and _instance are // immutable after creation until they are removed in // destroy(). - + // Not check for deactivation here! - + assert(_instance != null); // Must not be called after destroy(). if(_threadPool != null) @@ -765,7 +764,7 @@ public final class ObjectAdapterI implements ObjectAdapter } final Properties properties = _instance.initializationData().properties; - java.util.ArrayList unknownProps = new java.util.ArrayList(); + java.util.List<String> unknownProps = new java.util.ArrayList<String>(); boolean noProps = filterProperties(unknownProps); // @@ -774,10 +773,10 @@ public final class ObjectAdapterI implements ObjectAdapter if(unknownProps.size() != 0 && properties.getPropertyAsIntWithDefault("Ice.Warn.UnknownProperties", 1) > 0) { String message = "found unknown properties for object adapter `" + _name + "':"; - java.util.Iterator p = unknownProps.iterator(); + java.util.Iterator<String> p = unknownProps.iterator(); while(p.hasNext()) { - message += "\n " + (String)p.next(); + message += "\n " + p.next(); } _instance.initializationData().logger.warning(message); } @@ -877,11 +876,11 @@ public final class ObjectAdapterI implements ObjectAdapter // Remove duplicate endpoints, so we have a list of unique // endpoints. // - for(int i = 0; i < _routerEndpoints.size()-1;) + for(int i = 0; i < _routerEndpoints.size() - 1;) { - java.lang.Object o1 = _routerEndpoints.get(i); - java.lang.Object o2 = _routerEndpoints.get(i + 1); - if(o1.equals(o2)) + IceInternal.EndpointI e1 = _routerEndpoints.get(i); + IceInternal.EndpointI e2 = _routerEndpoints.get(i + 1); + if(e1.equals(e2)) { _routerEndpoints.remove(i); } @@ -912,7 +911,7 @@ public final class ObjectAdapterI implements ObjectAdapter // Parse the endpoints, but don't store them in the adapter. The connection // factory might change it, for example, to fill in the real port number. // - java.util.ArrayList endpoints; + java.util.List<IceInternal.EndpointI> endpoints; if(endpointInfo.length() == 0) { endpoints = parseEndpoints(properties.getProperty(_name + ".Endpoints"), true); @@ -923,7 +922,7 @@ public final class ObjectAdapterI implements ObjectAdapter } for(int i = 0; i < endpoints.size(); ++i) { - IceInternal.EndpointI endp = (IceInternal.EndpointI)endpoints.get(i); + IceInternal.EndpointI endp = endpoints.get(i); IceInternal.IncomingConnectionFactory factory = new IceInternal.IncomingConnectionFactory(instance, endp, this, _name); _incomingConnectionFactories.add(factory); @@ -1068,7 +1067,7 @@ public final class ObjectAdapterI implements ObjectAdapter } } - private java.util.ArrayList + private java.util.List<IceInternal.EndpointI> parseEndpoints(String endpts, boolean oaEndpoints) { int beg; @@ -1076,7 +1075,7 @@ public final class ObjectAdapterI implements ObjectAdapter final String delim = " \t\n\r"; - java.util.ArrayList endpoints = new java.util.ArrayList(); + java.util.List<IceInternal.EndpointI> endpoints = new java.util.ArrayList<IceInternal.EndpointI>(); while(end < endpts.length()) { beg = IceUtilInternal.StringUtil.findFirstNotOf(endpts, delim, end); @@ -1150,7 +1149,7 @@ public final class ObjectAdapterI implements ObjectAdapter return endpoints; } - private java.util.ArrayList + private java.util.List<IceInternal.EndpointI> parsePublishedEndpoints() { // @@ -1158,7 +1157,7 @@ public final class ObjectAdapterI implements ObjectAdapter // instead of the connection factory Endpoints. // String endpts = _instance.initializationData().properties.getProperty(_name + ".PublishedEndpoints"); - java.util.ArrayList endpoints = parseEndpoints(endpts, false); + java.util.List<IceInternal.EndpointI> endpoints = parseEndpoints(endpts, false); if(!endpoints.isEmpty()) { return endpoints; @@ -1170,8 +1169,7 @@ public final class ObjectAdapterI implements ObjectAdapter // for(int i = 0; i < _incomingConnectionFactories.size(); ++i) { - IceInternal.IncomingConnectionFactory factory = - (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.get(i); + IceInternal.IncomingConnectionFactory factory = _incomingConnectionFactories.get(i); endpoints.add(factory.endpoint()); } @@ -1179,11 +1177,11 @@ public final class ObjectAdapterI implements ObjectAdapter // Expand any endpoints that may be listening on INADDR_ANY to // include actual addresses in the published endpoints. // - java.util.ArrayList expandedEndpoints = new java.util.ArrayList(); - java.util.Iterator p = endpoints.iterator(); + java.util.List<IceInternal.EndpointI> expandedEndpoints = new java.util.ArrayList<IceInternal.EndpointI>(); + java.util.Iterator<IceInternal.EndpointI> p = endpoints.iterator(); while(p.hasNext()) { - expandedEndpoints.addAll(((IceInternal.EndpointI)p.next()).expand()); + expandedEndpoints.addAll(p.next().expand()); } return expandedEndpoints; } @@ -1246,7 +1244,7 @@ public final class ObjectAdapterI implements ObjectAdapter s.append("the object adapter is not known to the locator registry"); _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString()); } - + NotRegisteredException ex1 = new NotRegisteredException(); ex1.kindOfObject = "object adapter"; ex1.id = _id; @@ -1312,7 +1310,7 @@ public final class ObjectAdapterI implements ObjectAdapter _instance.initializationData().logger.trace(_instance.traceLevels().locationCat, s.toString()); } } - + if(registerProcess && serverId.length() > 0) { synchronized(this) @@ -1354,7 +1352,7 @@ public final class ObjectAdapterI implements ObjectAdapter } throw ex; // TODO: Shall we raise a special exception instead of a non obvious local exception? } - + if(_instance.traceLevels().location >= 1) { StringBuffer s = new StringBuffer(); @@ -1383,7 +1381,7 @@ public final class ObjectAdapterI implements ObjectAdapter }; boolean - filterProperties(java.util.List unknownProps) + filterProperties(java.util.List<String> unknownProps) { // // Do not create unknown properties list if Ice prefix, ie Ice, Glacier2, etc @@ -1400,12 +1398,11 @@ public final class ObjectAdapterI implements ObjectAdapter } boolean noProps = true; - java.util.Map props = _instance.initializationData().properties.getPropertiesForPrefix(prefix); - java.util.Iterator p = props.entrySet().iterator(); + java.util.Map<String, String> props = _instance.initializationData().properties.getPropertiesForPrefix(prefix); + java.util.Iterator<String> p = props.keySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - String prop = (String)entry.getKey(); + String prop = p.next(); boolean valid = false; for(int i = 0; i < _suffixes.length; ++i) @@ -1438,10 +1435,12 @@ public final class ObjectAdapterI implements ObjectAdapter final private String _id; final private String _replicaGroupId; private IceInternal.Reference _reference; - private java.util.ArrayList _incomingConnectionFactories = new java.util.ArrayList(); - private java.util.ArrayList _routerEndpoints = new java.util.ArrayList(); + private java.util.List<IceInternal.IncomingConnectionFactory> _incomingConnectionFactories = + new java.util.ArrayList<IceInternal.IncomingConnectionFactory>(); + private java.util.List<IceInternal.EndpointI> _routerEndpoints = new java.util.ArrayList<IceInternal.EndpointI>(); private IceInternal.RouterInfo _routerInfo = null; - private java.util.ArrayList _publishedEndpoints = new java.util.ArrayList(); + private java.util.List<IceInternal.EndpointI> _publishedEndpoints = + new java.util.ArrayList<IceInternal.EndpointI>(); private IceInternal.LocatorInfo _locatorInfo; private int _directCount; private boolean _waitForActivate; diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java index 66285019a37..3b385dfd10c 100644 --- a/java/src/Ice/PluginManagerI.java +++ b/java/src/Ice/PluginManagerI.java @@ -26,13 +26,13 @@ public final class PluginManagerI implements PluginManager // // Invoke initialize() on the plugins, in the order they were loaded. // - java.util.ArrayList initializedPlugins = new java.util.ArrayList(); + java.util.List<Plugin> initializedPlugins = new java.util.ArrayList<Plugin>(); try { - java.util.Iterator i = _initOrder.iterator(); + java.util.Iterator<Plugin> i = _initOrder.iterator(); while(i.hasNext()) { - Plugin p = (Plugin)i.next(); + Plugin p = i.next(); p.initialize(); initializedPlugins.add(p); } @@ -43,10 +43,10 @@ public final class PluginManagerI implements PluginManager // Destroy the plugins that have been successfully initialized, in the // reverse order. // - java.util.ListIterator i = initializedPlugins.listIterator(initializedPlugins.size()); + java.util.ListIterator<Plugin> i = initializedPlugins.listIterator(initializedPlugins.size()); while(i.hasPrevious()) { - Plugin p = (Plugin)i.previous(); + Plugin p = i.previous(); try { p.destroy(); @@ -70,7 +70,7 @@ public final class PluginManagerI implements PluginManager throw new CommunicatorDestroyedException(); } - Plugin p = (Plugin)_plugins.get(name); + Plugin p = _plugins.get(name); if(p != null) { return p; @@ -104,10 +104,10 @@ public final class PluginManagerI implements PluginManager { if(_communicator != null) { - java.util.Iterator i = _plugins.values().iterator(); + java.util.Iterator<Plugin> i = _plugins.values().iterator(); while(i.hasNext()) { - Plugin p = (Plugin)i.next(); + Plugin p = i.next(); p.destroy(); } @@ -141,7 +141,7 @@ public final class PluginManagerI implements PluginManager // final String prefix = "Ice.Plugin."; Properties properties = _communicator.getProperties(); - java.util.Map plugins = properties.getPropertiesForPrefix(prefix); + java.util.Map<String, String> plugins = properties.getPropertiesForPrefix(prefix); final String loadOrder = properties.getProperty("Ice.PluginLoadOrder"); if(loadOrder.length() > 0) @@ -188,10 +188,10 @@ public final class PluginManagerI implements PluginManager // while(!plugins.isEmpty()) { - java.util.Iterator p = plugins.entrySet().iterator(); - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); + java.util.Iterator<java.util.Map.Entry<String, String> > p = plugins.entrySet().iterator(); + java.util.Map.Entry<String, String> entry = p.next(); - String name = ((String)entry.getKey()).substring(prefix.length()); + String name = entry.getKey().substring(prefix.length()); int dotPos = name.lastIndexOf('.'); if(dotPos != -1) @@ -207,8 +207,7 @@ public final class PluginManagerI implements PluginManager else if(suffix.equals("java")) { name = name.substring(0, dotPos); - String value = (String)entry.getValue(); - loadPlugin(name, value, cmdArgs); + loadPlugin(name, entry.getValue(), cmdArgs); p.remove(); } else @@ -225,10 +224,10 @@ public final class PluginManagerI implements PluginManager // // Is there a .java entry? // - String value = (String)entry.getValue(); + String value = entry.getValue(); p.remove(); - String javaValue = (String)plugins.remove("Ice.Plugin." + name + ".java"); + String javaValue = plugins.remove("Ice.Plugin." + name + ".java"); if(javaValue != null) { value = javaValue; @@ -384,8 +383,8 @@ public final class PluginManagerI implements PluginManager } private Communicator _communicator; - private java.util.HashMap _plugins = new java.util.HashMap(); - private java.util.ArrayList _initOrder = new java.util.ArrayList(); + private java.util.Map<String, Plugin> _plugins = new java.util.HashMap<String, Plugin>(); + private java.util.List<Plugin> _initOrder = new java.util.ArrayList<Plugin>(); private Logger _logger = null; private boolean _initialized; } diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java index d18ea835c0b..d78651ae2d7 100644 --- a/java/src/Ice/PropertiesI.java +++ b/java/src/Ice/PropertiesI.java @@ -33,20 +33,16 @@ public final class PropertiesI implements Properties getProperty(String key) { String result = null; - PropertyValue pv = (PropertyValue)_properties.get(key); + PropertyValue pv = _properties.get(key); if(pv == null) { - result = System.getProperty(key); + result = System.getProperty(key, ""); } else { pv.used = true; result = pv.value; } - if(result == null) - { - result = ""; - } return result; } @@ -54,20 +50,16 @@ public final class PropertiesI implements Properties getPropertyWithDefault(String key, String value) { String result = null; - PropertyValue pv = (PropertyValue)_properties.get(key); + PropertyValue pv = _properties.get(key); if(pv == null) { - result = System.getProperty(key); + result = System.getProperty(key, value); } else { pv.used = true; result = pv.value; } - if(result == null) - { - result = value; - } return result; } @@ -81,7 +73,7 @@ public final class PropertiesI implements Properties getPropertyAsIntWithDefault(String key, int value) { String result = null; - PropertyValue pv = (PropertyValue)_properties.get(key); + PropertyValue pv = _properties.get(key); if(pv == null) { result = System.getProperty(key); @@ -123,7 +115,7 @@ public final class PropertiesI implements Properties } String result = null; - PropertyValue pv = (PropertyValue)_properties.get(key); + PropertyValue pv = _properties.get(key); if(pv == null) { result = System.getProperty(key); @@ -152,18 +144,18 @@ public final class PropertiesI implements Properties } - public synchronized java.util.Map + public synchronized java.util.Map<String, String> getPropertiesForPrefix(String prefix) { - java.util.HashMap result = new java.util.HashMap(); - java.util.Iterator p = _properties.entrySet().iterator(); + java.util.HashMap<String, String> result = new java.util.HashMap<String, String>(); + java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = _properties.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - String key = (String)entry.getKey(); + java.util.Map.Entry<String, PropertyValue> entry = p.next(); + String key = entry.getKey(); if(prefix.length() == 0 || key.startsWith(prefix)) { - PropertyValue pv = (PropertyValue)entry.getValue(); + PropertyValue pv = entry.getValue(); pv.used = true; result.put(key, pv.value); } @@ -191,6 +183,10 @@ public final class PropertiesI implements Properties { String pattern = IceInternal.PropertyNames.validProps[i][0].pattern(); dotPos = pattern.indexOf('.'); + // + // Each top level prefix describes a non-empty namespace. Having a string without a + // prefix followed by a dot is an error. + // assert(dotPos != -1); String propPrefix = pattern.substring(0, dotPos - 1); if(!propPrefix.equals(prefix)) @@ -229,7 +225,7 @@ public final class PropertiesI implements Properties // if(value != null && value.length() > 0) { - PropertyValue pv = (PropertyValue)_properties.get(key); + PropertyValue pv = _properties.get(key); if(pv != null) { pv.value = value; @@ -251,12 +247,12 @@ public final class PropertiesI implements Properties getCommandLineOptions() { String[] result = new String[_properties.size()]; - java.util.Iterator p = _properties.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = _properties.entrySet().iterator(); int i = 0; while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - result[i++] = "--" + entry.getKey() + "=" + ((PropertyValue)entry.getValue()).value; + java.util.Map.Entry<String, PropertyValue> entry = p.next(); + result[i++] = "--" + entry.getKey() + "=" + entry.getValue().value; } assert(i == result.length); return result; @@ -271,7 +267,7 @@ public final class PropertiesI implements Properties } pfx = "--" + pfx; - java.util.ArrayList result = new java.util.ArrayList(); + java.util.ArrayList<String> result = new java.util.ArrayList<String>(); for(int i = 0; i < options.length; i++) { String opt = options[i]; @@ -289,9 +285,7 @@ public final class PropertiesI implements Properties result.add(opt); } } - String[] arr = new String[result.size()]; - result.toArray(arr); - return arr; + return (String[])result.toArray(new String[0]); } public String[] @@ -330,18 +324,18 @@ public final class PropertiesI implements Properties return new PropertiesI(this); } - public synchronized java.util.List + public synchronized java.util.List<String> getUnusedProperties() { - java.util.List unused = new java.util.ArrayList(); - java.util.Iterator p = _properties.entrySet().iterator(); + java.util.List<String> unused = new java.util.ArrayList<String>(); + java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = _properties.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - PropertyValue pv = (PropertyValue)entry.getValue(); + java.util.Map.Entry<String, PropertyValue> entry = p.next(); + PropertyValue pv = entry.getValue(); if(!pv.used) { - unused.add((String)entry.getKey()); + unused.add(entry.getKey()); } } return unused; @@ -353,12 +347,12 @@ public final class PropertiesI implements Properties // NOTE: we can't just do a shallow copy of the map as the map values // would otherwise be shared between the two PropertiesI object. // - //_properties = new java.util.HashMap(p._properties); - java.util.Iterator p = props._properties.entrySet().iterator(); + //_properties = new java.util.HashMap<String, PropertyValue>(props._properties); + java.util.Iterator<java.util.Map.Entry<String, PropertyValue> > p = props._properties.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - _properties.put(entry.getKey(), new PropertyValue((PropertyValue)entry.getValue())); + java.util.Map.Entry<String, PropertyValue> entry = p.next(); + _properties.put(entry.getKey(), new PropertyValue(entry.getValue())); } } @@ -370,7 +364,7 @@ public final class PropertiesI implements Properties { if(defaults != null) { - _properties = new java.util.HashMap(((PropertiesI)defaults)._properties); + _properties = new java.util.HashMap<String, PropertyValue>(((PropertiesI)defaults)._properties); } boolean loadConfigFiles = false; @@ -397,6 +391,14 @@ public final class PropertiesI implements Properties } } + if(!loadConfigFiles) + { + // + // If Ice.Config is not set, load from ICE_CONFIG (if set) + // + loadConfigFiles = !_properties.containsKey("Ice.Config"); + } + if(loadConfigFiles) { loadConfig(); @@ -479,9 +481,21 @@ public final class PropertiesI implements Properties { String value = getProperty("Ice.Config"); - if(value.equals("1")) + if(value.length() == 0 || value.equals("1")) { - value = ""; + try + { + value = System.getenv("ICE_CONFIG"); + if(value == null) + { + value = ""; + } + } + catch(SecurityException ex) + { + Ice.Util.getProcessLogger().warning("unable to access ICE_CONFIG environment variable"); + value = ""; + } } if(value.length() > 0) @@ -501,7 +515,7 @@ public final class PropertiesI implements Properties // private String[] splitString(String str, String delim) { - java.util.List l = new java.util.ArrayList(); + java.util.List<String> l = new java.util.ArrayList<String>(); char[] arr = new char[str.length()]; int pos = 0; @@ -516,7 +530,8 @@ public final class PropertiesI implements Properties } while(pos < str.length()) { - if(quoteChar != '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() && str.charAt(pos + 1) == quoteChar) + if(quoteChar != '\0' && str.charAt(pos) == '\\' && pos + 1 < str.length() && + str.charAt(pos + 1) == quoteChar) { ++pos; } @@ -553,5 +568,5 @@ public final class PropertiesI implements Properties return (String[])l.toArray(new String[0]); } - private java.util.HashMap _properties = new java.util.HashMap(); + private java.util.HashMap<String, PropertyValue> _properties = new java.util.HashMap<String, PropertyValue>(); } diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java index 65f321861ad..ed1904ec76f 100644 --- a/java/src/Ice/_ObjectDelD.java +++ b/java/src/Ice/_ObjectDelD.java @@ -280,11 +280,11 @@ public class _ObjectDelD implements _ObjectDel ImplicitContextI implicitContext = __reference.getInstance().getImplicitContext(); - java.util.Map prxContext = __reference.getContext(); + java.util.Map<String, String> prxContext = __reference.getContext(); if(implicitContext == null) { - current.ctx = new java.util.HashMap(prxContext); + current.ctx = new java.util.HashMap<String, String>(prxContext); } else { diff --git a/java/src/IceBox/Admin.java b/java/src/IceBox/Admin.java index 133b0eee01c..5402d7c1086 100644 --- a/java/src/IceBox/Admin.java +++ b/java/src/IceBox/Admin.java @@ -30,7 +30,7 @@ public final class Admin public int run(String[] args) { - java.util.ArrayList commands = new java.util.ArrayList(); + java.util.List<String> commands = new java.util.ArrayList<String>(); int idx = 0; while(idx < args.length) diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java index 611657a1773..297438f06f4 100644 --- a/java/src/IceBox/ServiceManagerI.java +++ b/java/src/IceBox/ServiceManagerI.java @@ -21,7 +21,8 @@ public class ServiceManagerI extends _ServiceManagerDisp _server = server; _logger = _server.communicator().getLogger(); _argv = args; - _traceServiceObserver = _server.communicator().getProperties().getPropertyAsInt("IceBox.Trace.ServiceObserver"); + _traceServiceObserver = + _server.communicator().getProperties().getPropertyAsInt("IceBox.Trace.ServiceObserver"); } public java.util.Map @@ -76,10 +77,10 @@ public class ServiceManagerI extends _ServiceManagerDisp java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.flush(); - _logger.warning("ServiceManager: exception in start for service " + info.name + "\n" + + _logger.warning("ServiceManager: exception in start for service " + info.name + "\n" + sw.toString()); } - + java.util.Set<ServiceObserverPrx> observers = null; synchronized(this) { @@ -92,7 +93,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(started) { in.status = StatusStarted; - observers = (java.util.Set<ServiceObserverPrx>)_observers.clone(); + observers = new java.util.HashSet<ServiceObserverPrx>(_observers); } else { @@ -107,7 +108,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(observers != null) { - java.util.List<String> services = new java.util.Vector<String>(); + java.util.List<String> services = new java.util.ArrayList<String>(); services.add(name); servicesStarted(services, observers); } @@ -158,10 +159,10 @@ public class ServiceManagerI extends _ServiceManagerDisp java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.flush(); - _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + + _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + sw.toString()); } - + java.util.Set<ServiceObserverPrx> observers = null; synchronized(this) { @@ -174,7 +175,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(stopped) { in.status = StatusStopped; - observers = (java.util.Set<ServiceObserverPrx>)_observers.clone(); + observers = new java.util.HashSet<ServiceObserverPrx>(_observers); } else { @@ -189,7 +190,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(observers != null) { - java.util.List<String> services = new java.util.Vector<String>(); + java.util.List<String> services = new java.util.ArrayList<String>(); services.add(name); servicesStopped(services, observers); } @@ -212,9 +213,9 @@ public class ServiceManagerI extends _ServiceManagerDisp { _logger.trace("IceBox.ServiceObserver", "Added service observer " + _server.communicator().proxyToString(observer)); - } - - + } + + for(ServiceInfo info: _services) { if(info.status == StatusStarted) @@ -222,10 +223,10 @@ public class ServiceManagerI extends _ServiceManagerDisp activeServices.add(info.name); } } - + } } - + if(activeServices.size() > 0) { AMI_ServiceObserver_servicesStarted cb = new AMI_ServiceObserver_servicesStarted() @@ -234,7 +235,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { // ok, success } - + public void ice_exception(Ice.LocalException ex) { // @@ -243,7 +244,7 @@ public class ServiceManagerI extends _ServiceManagerDisp removeObserver(observer, ex); } }; - + observer.servicesStarted_async(cb, activeServices.toArray(new String[0])); } } @@ -299,7 +300,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // then load any remaining services. // final String prefix = "IceBox.Service."; - java.util.Map services = properties.getPropertiesForPrefix(prefix); + java.util.Map<String, String> services = properties.getPropertiesForPrefix(prefix); if(loadOrder != null) { for(int i = 0; i < loadOrder.length; ++i) @@ -307,7 +308,7 @@ public class ServiceManagerI extends _ServiceManagerDisp if(loadOrder[i].length() > 0) { String key = prefix + loadOrder[i]; - String value = (String)services.get(key); + String value = services.get(key); if(value == null) { FailureException ex = new FailureException(); @@ -319,12 +320,12 @@ public class ServiceManagerI extends _ServiceManagerDisp } } } - java.util.Iterator p = services.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, String> > p = services.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - String name = ((String)entry.getKey()).substring(prefix.length()); - String value = (String)entry.getValue(); + java.util.Map.Entry<String, String> entry = p.next(); + String name = entry.getKey().substring(prefix.length()); + String value = entry.getValue(); load(name, value); } @@ -354,7 +355,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // _server.shutdownOnInterrupt(); - + // // Register "this" as a facet to the Admin object and // create Admin object @@ -365,7 +366,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // // Add a Properties facet for each service - // + // for(ServiceInfo info: _services) { Ice.Communicator communicator = info.communicator != null ? info.communicator : _sharedCommunicator; @@ -382,7 +383,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // } - // + // // Start request dispatching after we've started the services. // if(adapter != null) @@ -487,7 +488,7 @@ public class ServiceManagerI extends _ServiceManagerDisp // shared communicator, depending on the value of the // IceBox.UseSharedCommunicator property. // - java.util.ArrayList l = new java.util.ArrayList(); + java.util.List<String> l = new java.util.ArrayList<String>(); for(int j = 0; j < args.length; j++) { l.add(args[j]); @@ -499,7 +500,7 @@ public class ServiceManagerI extends _ServiceManagerDisp l.add(_argv[j]); } } - + Ice.StringSeqHolder serviceArgs = new Ice.StringSeqHolder(); serviceArgs.value = (String[])l.toArray(new String[0]); @@ -573,25 +574,26 @@ public class ServiceManagerI extends _ServiceManagerDisp // // Erase properties in 'properties' // - java.util.Map allProps = properties.getPropertiesForPrefix(""); - java.util.Iterator p = allProps.keySet().iterator(); + java.util.Map<String, String> allProps = properties.getPropertiesForPrefix(""); + java.util.Iterator<String> p = allProps.keySet().iterator(); while(p.hasNext()) { - String key = (String)p.next(); + String key = p.next(); if(svcProperties.getProperty(key).length() == 0) { properties.setProperty(key, ""); } } - + // // Add the service properties to the shared communicator properties. // - p = svcProperties.getPropertiesForPrefix("").entrySet().iterator(); - while(p.hasNext()) + java.util.Iterator<java.util.Map.Entry<String, String> > q = + svcProperties.getPropertiesForPrefix("").entrySet().iterator(); + while(q.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - properties.setProperty((String)entry.getKey(), (String)entry.getValue()); + java.util.Map.Entry<String, String> entry = q.next(); + properties.setProperty(entry.getKey(), entry.getValue()); } // @@ -605,7 +607,7 @@ public class ServiceManagerI extends _ServiceManagerDisp info.communicator = createCommunicator(service, serviceArgs); communicator = info.communicator; } - + try { info.args = serviceArgs.value; @@ -614,8 +616,8 @@ public class ServiceManagerI extends _ServiceManagerDisp // // There is no need to notify the observers since the 'start all' - // (that indirectly calls this method) occurs before the creation of - // the Server Admin object, and before the activation of the main + // (that indirectly calls this method) occurs before the creation of + // the Server Admin object, and before the activation of the main // object adapter (so before any observer can be registered) // } @@ -644,7 +646,7 @@ public class ServiceManagerI extends _ServiceManagerDisp _logger.warning("ServiceManager: exception in shutting down communicator for service " + service + "\n" + sw.toString()); } - + try { info.communicator.destroy(); @@ -680,9 +682,9 @@ public class ServiceManagerI extends _ServiceManagerDisp private void stopAll() { - java.util.List<String> stoppedServices = new java.util.Vector<String>(); + java.util.List<String> stoppedServices = new java.util.ArrayList<String>(); java.util.Set<ServiceObserverPrx> observers = null; - + synchronized(this) { // @@ -698,15 +700,15 @@ public class ServiceManagerI extends _ServiceManagerDisp { } } - + // - // For each service, we call stop on the service and flush its database environment to + // For each service, we call stop on the service and flush its database environment to // the disk. Services are stopped in the reverse order of the order they were started. // - java.util.ListIterator p = _services.listIterator(_services.size()); + java.util.ListIterator<ServiceInfo> p = _services.listIterator(_services.size()); while(p.hasPrevious()) { - ServiceInfo info = (ServiceInfo)p.previous(); + ServiceInfo info = p.previous(); if(info.status == StatusStarted) { try @@ -721,11 +723,11 @@ public class ServiceManagerI extends _ServiceManagerDisp java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.flush(); - _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + + _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + sw.toString()); } } - + try { _server.communicator().removeAdminFacet("IceBox.Service." + info.name + ".Properties"); @@ -734,7 +736,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { // Ignored } - + if(info.communicator != null) { try @@ -755,10 +757,10 @@ public class ServiceManagerI extends _ServiceManagerDisp java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.flush(); - _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + + _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + sw.toString()); } - + try { info.communicator.destroy(); @@ -769,7 +771,7 @@ public class ServiceManagerI extends _ServiceManagerDisp java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.flush(); - _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + + _logger.warning("ServiceManager: exception in stop for service " + info.name + "\n" + sw.toString()); } } @@ -787,20 +789,19 @@ public class ServiceManagerI extends _ServiceManagerDisp java.io.PrintWriter pw = new java.io.PrintWriter(sw); e.printStackTrace(pw); pw.flush(); - _logger.warning("ServiceManager: unknown exception while destroying shared communicator:\n" + + _logger.warning("ServiceManager: unknown exception while destroying shared communicator:\n" + sw.toString()); } _sharedCommunicator = null; } _services.clear(); - observers = (java.util.Set<ServiceObserverPrx>)_observers.clone(); + observers = new java.util.HashSet<ServiceObserverPrx>(_observers); } servicesStopped(stoppedServices, observers); } - private void servicesStarted(java.util.List<String> services, java.util.Set<ServiceObserverPrx> observers) { @@ -818,7 +819,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { // ok, success } - + public void ice_exception(Ice.LocalException ex) { // @@ -850,7 +851,7 @@ public class ServiceManagerI extends _ServiceManagerDisp { // ok, success } - + public void ice_exception(Ice.LocalException ex) { // @@ -874,8 +875,8 @@ public class ServiceManagerI extends _ServiceManagerDisp observerRemoved(observer, ex); } } - - private void + + private void observerRemoved(ServiceObserverPrx observer, RuntimeException ex) { if(_traceServiceObserver >= 1) @@ -883,14 +884,14 @@ public class ServiceManagerI extends _ServiceManagerDisp _logger.trace("IceBox.ServiceObserver", "Removed service observer " + _server.communicator().proxyToString(observer) + "\nafter catching " + ex.toString()); - } - } + } + } public final static int StatusStopping = 0; public final static int StatusStopped = 1; public final static int StatusStarting = 2; public final static int StatusStarted = 3; - + static class ServiceInfo implements Cloneable { public Object clone() @@ -919,19 +920,19 @@ public class ServiceManagerI extends _ServiceManagerDisp { _properties = properties; } - + public String getProperty(String name, Ice.Current current) { return _properties.getProperty(name); } - - public java.util.TreeMap + + public java.util.TreeMap<String, String> getPropertiesForPrefix(String name, Ice.Current current) { - return new java.util.TreeMap(_properties.getPropertiesForPrefix(name)); + return new java.util.TreeMap<String, String>(_properties.getPropertiesForPrefix(name)); } - + private final Ice.Properties _properties; } @@ -956,8 +957,8 @@ public class ServiceManagerI extends _ServiceManagerDisp } // - // Set the default program name for the service properties. By default it's - // the IceBox program name + "-" + the service name, or just the IceBox + // Set the default program name for the service properties. By default it's + // the IceBox program name + "-" + the service name, or just the IceBox // program name if we're creating the shared communicator (service == ""). // String programName = communicatorProperties.getProperty("Ice.ProgramName"); @@ -991,11 +992,11 @@ public class ServiceManagerI extends _ServiceManagerDisp // read the service config file if it's specified with --Ice.Config. // properties = Ice.Util.createProperties(args, properties); - + if(service.length() > 0) { // - // Next, parse the service "<service>.*" command line options (the Ice command + // Next, parse the service "<service>.*" command line options (the Ice command // line options were parsed by the createProperties above) // args.value = properties.parseCommandLineOptions(service, args.value); @@ -1003,7 +1004,7 @@ public class ServiceManagerI extends _ServiceManagerDisp } // - // Remaining command line options are passed to the communicator. This is + // Remaining command line options are passed to the communicator. This is // necessary for Ice plugin properties (e.g.: IceSSL). // Ice.InitializationData initData = new Ice.InitializationData(); diff --git a/java/src/IceGridGUI/Application/Node.java b/java/src/IceGridGUI/Application/Node.java index 86f11a8a817..35f0650e5e6 100755 --- a/java/src/IceGridGUI/Application/Node.java +++ b/java/src/IceGridGUI/Application/Node.java @@ -634,7 +634,7 @@ class Node extends TreeNode implements PropertySetParent PropertySet ps = (PropertySet)p.next(); if(ps.getEditable().isNew() || ps.getEditable().isModified()) { - update.propertySets.put(ps.getId(), ps.getDescriptor()); + update.propertySets.put(ps.getId(), (PropertySetDescriptor)ps.getDescriptor()); } } } @@ -663,11 +663,11 @@ class Node extends TreeNode implements PropertySetParent { if(server instanceof PlainServer) { - update.servers.add(server.getDescriptor()); + update.servers.add((ServerDescriptor)server.getDescriptor()); } else { - update.serverInstances.add(server.getDescriptor()); + update.serverInstances.add((ServerInstanceDescriptor)server.getDescriptor()); } } } diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java index c24fcf490fe..c2a3084ba67 100644 --- a/java/src/IceInternal/BasicStream.java +++ b/java/src/IceInternal/BasicStream.java @@ -131,7 +131,7 @@ public class BasicStream other._seqDataStack = _seqDataStack; _seqDataStack = tmpSeqDataStack; - java.util.ArrayList tmpObjectList = other._objectList; + java.util.ArrayList<Ice.Object> tmpObjectList = other._objectList; other._objectList = _objectList; _objectList = tmpObjectList; @@ -590,7 +590,7 @@ public class BasicStream public void writeTypeId(String id) { - Integer index = (Integer)_writeEncapsStack.typeIdMap.get(id); + Integer index = _writeEncapsStack.typeIdMap.get(id); if(index != null) { writeBool(true); @@ -614,7 +614,7 @@ public class BasicStream if(isIndex) { index = new Integer(readSize()); - id = (String)_readEncapsStack.typeIdMap.get(index); + id = _readEncapsStack.typeIdMap.get(index); if(id == null) { throw new Ice.UnmarshalOutOfBoundsException(); @@ -1312,22 +1312,22 @@ public class BasicStream if(_writeEncapsStack.toBeMarshaledMap == null) // Lazy initialization { - _writeEncapsStack.toBeMarshaledMap = new java.util.IdentityHashMap(); - _writeEncapsStack.marshaledMap = new java.util.IdentityHashMap(); - _writeEncapsStack.typeIdMap = new java.util.TreeMap(); + _writeEncapsStack.toBeMarshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + _writeEncapsStack.marshaledMap = new java.util.IdentityHashMap<Ice.Object, Integer>(); + _writeEncapsStack.typeIdMap = new java.util.TreeMap<String, Integer>(); } if(v != null) { // // Look for this instance in the to-be-marshaled map. // - Integer p = (Integer)_writeEncapsStack.toBeMarshaledMap.get(v); + Integer p = _writeEncapsStack.toBeMarshaledMap.get(v); if(p == null) { // // Didn't find it, try the marshaled map next. // - Integer q = (Integer)_writeEncapsStack.marshaledMap.get(v); + Integer q = _writeEncapsStack.marshaledMap.get(v); if(q == null) { // @@ -1368,9 +1368,9 @@ public class BasicStream if(_readEncapsStack.patchMap == null) // Lazy initialization { - _readEncapsStack.patchMap = new java.util.TreeMap(); - _readEncapsStack.unmarshaledMap = new java.util.TreeMap(); - _readEncapsStack.typeIdMap = new java.util.TreeMap(); + _readEncapsStack.patchMap = new java.util.TreeMap<Integer, java.util.LinkedList<Patcher> >(); + _readEncapsStack.unmarshaledMap = new java.util.TreeMap<Integer, Ice.Object>(); + _readEncapsStack.typeIdMap = new java.util.TreeMap<Integer, String>(); } int index = readInt(); @@ -1384,14 +1384,14 @@ public class BasicStream if(index < 0 && patcher != null) { Integer i = new Integer(-index); - java.util.LinkedList patchlist = (java.util.LinkedList)_readEncapsStack.patchMap.get(i); + java.util.LinkedList<Patcher> patchlist = _readEncapsStack.patchMap.get(i); if(patchlist == null) { // // We have no outstanding instances to be patched for // this index, so make a new entry in the patch map. // - patchlist = new java.util.LinkedList(); + patchlist = new java.util.LinkedList<Patcher>(); _readEncapsStack.patchMap.put(i, patchlist); } // @@ -1493,7 +1493,7 @@ public class BasicStream // if(_objectList == null) { - _objectList = new java.util.ArrayList(); + _objectList = new java.util.ArrayList<Ice.Object>(); } _objectList.add(v); @@ -1587,9 +1587,11 @@ public class BasicStream { while(_writeEncapsStack.toBeMarshaledMap.size() > 0) { - java.util.IdentityHashMap savedMap = new java.util.IdentityHashMap(_writeEncapsStack.toBeMarshaledMap); + java.util.IdentityHashMap<Ice.Object, Integer> savedMap = + new java.util.IdentityHashMap<Ice.Object, Integer>(_writeEncapsStack.toBeMarshaledMap); writeSize(savedMap.size()); - for(java.util.Iterator p = savedMap.entrySet().iterator(); p.hasNext(); ) + java.util.Iterator<java.util.Map.Entry<Ice.Object, Integer> > p = savedMap.entrySet().iterator(); + while(p.hasNext()) { // // Add an instance from the old to-be-marshaled @@ -1598,9 +1600,9 @@ public class BasicStream // instances that are triggered by the classes // marshaled are added to toBeMarshaledMap. // - java.util.Map.Entry e = (java.util.Map.Entry)p.next(); + java.util.Map.Entry<Ice.Object, Integer> e = p.next(); _writeEncapsStack.marshaledMap.put(e.getKey(), e.getValue()); - writeInstance((Ice.Object)e.getKey(), (Integer)e.getValue()); + writeInstance(e.getKey(), e.getValue()); } // @@ -1608,9 +1610,10 @@ public class BasicStream // substract what we have marshaled from the // toBeMarshaledMap. // - for(java.util.Iterator p = savedMap.keySet().iterator(); p.hasNext(); ) + java.util.Iterator<Ice.Object> q = savedMap.keySet().iterator(); + while(q.hasNext()) { - _writeEncapsStack.toBeMarshaledMap.remove(p.next()); + _writeEncapsStack.toBeMarshaledMap.remove(q.next()); } } } @@ -1639,10 +1642,10 @@ public class BasicStream // if(_objectList != null) { - java.util.Iterator e = _objectList.iterator(); + java.util.Iterator<Ice.Object> e = _objectList.iterator(); while(e.hasNext()) { - Ice.Object obj = (Ice.Object)e.next(); + Ice.Object obj = e.next(); try { obj.ice_postUnmarshal(); @@ -1703,7 +1706,7 @@ public class BasicStream // assert((instanceIndex != null && patchIndex == null) || (instanceIndex == null && patchIndex != null)); - java.util.LinkedList patchlist; + java.util.LinkedList<Patcher> patchlist; Ice.Object v; if(instanceIndex != null) { @@ -1711,12 +1714,12 @@ public class BasicStream // We have just unmarshaled an instance -- check if // something needs patching for that instance. // - patchlist = (java.util.LinkedList)_readEncapsStack.patchMap.get(instanceIndex); + patchlist = _readEncapsStack.patchMap.get(instanceIndex); if(patchlist == null) { return; // We don't have anything to patch for the instance just unmarshaled } - v = (Ice.Object)_readEncapsStack.unmarshaledMap.get(instanceIndex); + v = _readEncapsStack.unmarshaledMap.get(instanceIndex); patchIndex = instanceIndex; } else @@ -1725,12 +1728,12 @@ public class BasicStream // We have just unmarshaled an index -- check if we have // unmarshaled the instance for that index yet. // - v = (Ice.Object)_readEncapsStack.unmarshaledMap.get(patchIndex); + v = _readEncapsStack.unmarshaledMap.get(patchIndex); if(v == null) { return; // We haven't unmarshaled the instance for this index yet } - patchlist = (java.util.LinkedList)_readEncapsStack.patchMap.get(patchIndex); + patchlist = _readEncapsStack.patchMap.get(patchIndex); } assert(patchlist != null && patchlist.size() > 0); assert(v != null); @@ -1738,9 +1741,9 @@ public class BasicStream // // Patch all references that refer to the instance. // - for(java.util.Iterator i = patchlist.iterator(); i.hasNext(); ) + for(java.util.Iterator<Patcher> i = patchlist.iterator(); i.hasNext(); ) { - Patcher p = (Patcher)i.next(); + Patcher p = i.next(); try { p.patch(v); @@ -2150,7 +2153,7 @@ public class BasicStream synchronized(_factoryMutex) { - factory = (UserExceptionFactory)_exceptionFactories.get(id); + factory = _exceptionFactories.get(id); } if(factory == null) @@ -2326,10 +2329,10 @@ public class BasicStream byte encodingMajor; byte encodingMinor; - java.util.TreeMap patchMap; - java.util.TreeMap unmarshaledMap; + java.util.TreeMap<Integer, java.util.LinkedList<Patcher> > patchMap; + java.util.TreeMap<Integer, Ice.Object> unmarshaledMap; int typeIdIndex; - java.util.TreeMap typeIdMap; + java.util.TreeMap<Integer, String> typeIdMap; ReadEncaps next; void @@ -2350,10 +2353,10 @@ public class BasicStream int start; int writeIndex; - java.util.IdentityHashMap toBeMarshaledMap; - java.util.IdentityHashMap marshaledMap; + java.util.IdentityHashMap<Ice.Object, Integer> toBeMarshaledMap; + java.util.IdentityHashMap<Ice.Object, Integer> marshaledMap; int typeIdIndex; - java.util.TreeMap typeIdMap; + java.util.TreeMap<String, Integer> typeIdMap; WriteEncaps next; void @@ -2400,9 +2403,10 @@ public class BasicStream } SeqData _seqDataStack; - private java.util.ArrayList _objectList; + private java.util.ArrayList<Ice.Object> _objectList; - private static java.util.HashMap _exceptionFactories = new java.util.HashMap(); + private static java.util.HashMap<String, UserExceptionFactory> _exceptionFactories = + new java.util.HashMap<String, UserExceptionFactory>(); private static java.lang.Object _factoryMutex = new java.lang.Object(); // Protects _exceptionFactories. public static boolean @@ -2417,8 +2421,8 @@ public class BasicStream { try { - Class cls; - Class[] types = new Class[1]; + Class<?> cls; + Class<?>[] types = new Class<?>[1]; cls = Class.forName("org.apache.tools.bzip2.CBZip2InputStream"); types[0] = java.io.InputStream.class; _bzInputStreamCtor = cls.getDeclaredConstructor(types); diff --git a/java/src/IceInternal/ConnectRequestHandler.java b/java/src/IceInternal/ConnectRequestHandler.java index bebd060b41c..ab38043e5a0 100644 --- a/java/src/IceInternal/ConnectRequestHandler.java +++ b/java/src/IceInternal/ConnectRequestHandler.java @@ -183,7 +183,7 @@ public class ConnectRequestHandler } public Outgoing - getOutgoing(String operation, Ice.OperationMode mode, java.util.Map context) + getOutgoing(String operation, Ice.OperationMode mode, java.util.Map<String, String> context) throws LocalExceptionWrapper { synchronized(this) @@ -397,10 +397,10 @@ public class ConnectRequestHandler try { - java.util.Iterator p = _requests.iterator(); // _requests is immutable when _flushing = true + java.util.Iterator<Request> p = _requests.iterator(); // _requests is immutable when _flushing = true while(p.hasNext()) { - Request request = (Request)p.next(); + Request request = p.next(); if(request.out != null) { _connection.sendAsyncRequest(request.out, _compress, _response); @@ -493,10 +493,10 @@ public class ConnectRequestHandler void flushRequestsWithException(Ice.LocalException ex) { - java.util.Iterator p = _requests.iterator(); + java.util.Iterator<Request> p = _requests.iterator(); while(p.hasNext()) { - Request request = (Request)p.next(); + Request request = p.next(); if(request.out != null) { request.out.__finished(ex); @@ -512,10 +512,10 @@ public class ConnectRequestHandler void flushRequestsWithException(LocalExceptionWrapper ex) { - java.util.Iterator p = _requests.iterator(); + java.util.Iterator<Request> p = _requests.iterator(); while(p.hasNext()) { - Request request = (Request)p.next(); + Request request = p.next(); if(request.out != null) { request.out.__finished(ex); @@ -539,7 +539,7 @@ public class ConnectRequestHandler private boolean _response; private Ice.LocalException _exception = null; - private java.util.List _requests = new java.util.LinkedList(); + private java.util.List<Request> _requests = new java.util.LinkedList<Request>(); private boolean _batchRequestInProgress; private int _batchRequestsSize; private BasicStream _batchStream; diff --git a/java/src/IceInternal/ConnectionMonitor.java b/java/src/IceInternal/ConnectionMonitor.java index 9a08f9612e7..6483c5242af 100644 --- a/java/src/IceInternal/ConnectionMonitor.java +++ b/java/src/IceInternal/ConnectionMonitor.java @@ -61,7 +61,7 @@ public final class ConnectionMonitor implements IceInternal.TimerTask public void runTimerTask() { - java.util.HashSet connections = new java.util.HashSet(); + java.util.Set<Ice.ConnectionI> connections = new java.util.HashSet<Ice.ConnectionI>(); synchronized(this) { @@ -79,10 +79,10 @@ public final class ConnectionMonitor implements IceInternal.TimerTask // so that connections can be added or removed during // monitoring. // - java.util.Iterator iter = connections.iterator(); + java.util.Iterator<Ice.ConnectionI> iter = connections.iterator(); while(iter.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)iter.next(); + Ice.ConnectionI connection = iter.next(); try { @@ -125,5 +125,5 @@ public final class ConnectionMonitor implements IceInternal.TimerTask } private Instance _instance; - private java.util.HashSet _connections = new java.util.HashSet(); + private java.util.Set<Ice.ConnectionI> _connections = new java.util.HashSet<Ice.ConnectionI>(); } diff --git a/java/src/IceInternal/ConnectionRequestHandler.java b/java/src/IceInternal/ConnectionRequestHandler.java index 3296e6c8b94..8b74c44b9f1 100644 --- a/java/src/IceInternal/ConnectionRequestHandler.java +++ b/java/src/IceInternal/ConnectionRequestHandler.java @@ -63,7 +63,7 @@ public class ConnectionRequestHandler implements RequestHandler } public Outgoing - getOutgoing(String operation, Ice.OperationMode mode, java.util.Map context) + getOutgoing(String operation, Ice.OperationMode mode, java.util.Map<String, String> context) throws LocalExceptionWrapper { return _connection.getOutgoing(this, operation, mode, context); diff --git a/java/src/IceInternal/DictionaryPatcher.java b/java/src/IceInternal/DictionaryPatcher.java index 67367acceca..545d474ca08 100644 --- a/java/src/IceInternal/DictionaryPatcher.java +++ b/java/src/IceInternal/DictionaryPatcher.java @@ -9,10 +9,10 @@ package IceInternal; -public class DictionaryPatcher implements Patcher, Ice.ReadObjectCallback +public class DictionaryPatcher<K, V> implements Patcher, Ice.ReadObjectCallback { public - DictionaryPatcher(java.util.Map dict, Class cls, String type, java.lang.Object key) + DictionaryPatcher(java.util.Map<K, V> dict, Class<V> cls, String type, K key) { _dict = dict; _cls = cls; @@ -35,7 +35,7 @@ public class DictionaryPatcher implements Patcher, Ice.ReadObjectCallback } } - _dict.put(_key, v); + _dict.put(_key, _cls.cast(v)); } public String @@ -50,8 +50,8 @@ public class DictionaryPatcher implements Patcher, Ice.ReadObjectCallback patch(v); } - private java.util.Map _dict; - private Class _cls; + private java.util.Map<K, V> _dict; + private Class<V> _cls; private String _type; - private java.lang.Object _key; + private K _key; } diff --git a/java/src/IceInternal/EndpointFactoryManager.java b/java/src/IceInternal/EndpointFactoryManager.java index ee8a957933b..f3663577f9b 100644 --- a/java/src/IceInternal/EndpointFactoryManager.java +++ b/java/src/IceInternal/EndpointFactoryManager.java @@ -21,7 +21,7 @@ public final class EndpointFactoryManager { for(int i = 0; i < _factories.size(); i++) { - EndpointFactory f = (EndpointFactory)_factories.get(i); + EndpointFactory f = _factories.get(i); if(f.type() == factory.type()) { assert(false); @@ -35,7 +35,7 @@ public final class EndpointFactoryManager { for(int i = 0; i < _factories.size(); i++) { - EndpointFactory f = (EndpointFactory)_factories.get(i); + EndpointFactory f = _factories.get(i); if(f.type() == type) { return f; @@ -69,7 +69,7 @@ public final class EndpointFactoryManager for(int i = 0; i < _factories.size(); i++) { - EndpointFactory f = (EndpointFactory)_factories.get(i); + EndpointFactory f = _factories.get(i); if(f.protocol().equals(protocol)) { return f.create(s.substring(m.end()), oaEndpoint); @@ -100,7 +100,7 @@ public final class EndpointFactoryManager EndpointI ue = new UnknownEndpointI(s.substring(m.end())); for(int i = 0; i < _factories.size(); i++) { - EndpointFactory f = (EndpointFactory)_factories.get(i); + EndpointFactory f = _factories.get(i); if(f.type() == ue.type()) { // @@ -130,7 +130,7 @@ public final class EndpointFactoryManager for(int i = 0; i < _factories.size(); i++) { - EndpointFactory f = (EndpointFactory)_factories.get(i); + EndpointFactory f = _factories.get(i); if(f.type() == type) { return f.read(s); @@ -144,12 +144,12 @@ public final class EndpointFactoryManager { for(int i = 0; i < _factories.size(); i++) { - EndpointFactory f = (EndpointFactory)_factories.get(i); + EndpointFactory f = _factories.get(i); f.destroy(); } _factories.clear(); } private Instance _instance; - private java.util.ArrayList _factories = new java.util.ArrayList(); + private java.util.List<EndpointFactory> _factories = new java.util.ArrayList<EndpointFactory>(); } diff --git a/java/src/IceInternal/EndpointHostResolver.java b/java/src/IceInternal/EndpointHostResolver.java index 97948959318..cc978401ec8 100644 --- a/java/src/IceInternal/EndpointHostResolver.java +++ b/java/src/IceInternal/EndpointHostResolver.java @@ -93,10 +93,10 @@ public class EndpointHostResolver Network.getAddresses(resolve.host, resolve.port, _instance.protocolSupport()))); } - java.util.Iterator p = _queue.iterator(); + java.util.Iterator<ResolveEntry> p = _queue.iterator(); while(p.hasNext()) { - ((ResolveEntry)p.next()).callback.exception(new Ice.CommunicatorDestroyedException()); + p.next().callback.exception(new Ice.CommunicatorDestroyedException()); } _queue.clear(); } @@ -111,7 +111,7 @@ public class EndpointHostResolver private final Instance _instance; private boolean _destroyed; - private java.util.LinkedList _queue = new java.util.LinkedList(); + private java.util.LinkedList<ResolveEntry> _queue = new java.util.LinkedList<ResolveEntry>(); private final class HelperThread extends Thread { diff --git a/java/src/IceInternal/EndpointI.java b/java/src/IceInternal/EndpointI.java index b58c616087f..fa5a44b9246 100644 --- a/java/src/IceInternal/EndpointI.java +++ b/java/src/IceInternal/EndpointI.java @@ -9,7 +9,7 @@ package IceInternal; -abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable +abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable<EndpointI> { public String toString() @@ -86,7 +86,7 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable // Return connectors for this endpoint, or empty list if no connector // is available. // - public abstract java.util.List connectors(); + public abstract java.util.List<Connector> connectors(); public abstract void connectors_async(EndpointI_connectors callback); // @@ -102,7 +102,7 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable // Expand endpoint out in to separate endpoints for each local // host if listening on INADDR_ANY. // - public abstract java.util.List expand(); + public abstract java.util.List<EndpointI> expand(); // // Check whether the endpoint is equivalent to another one. @@ -113,10 +113,10 @@ abstract public class EndpointI implements Ice.Endpoint, java.lang.Comparable // Compare endpoints for sorting purposes. // public abstract boolean equals(java.lang.Object obj); - public abstract int compareTo(java.lang.Object obj); // From java.lang.Comparable. + public abstract int compareTo(EndpointI obj); // From java.lang.Comparable. - public java.util.List - connectors(java.util.List addresses) + public java.util.List<Connector> + connectors(java.util.List<java.net.InetSocketAddress> addresses) { // // This method must be extended by endpoints which use the EndpointHostResolver to create diff --git a/java/src/IceInternal/EndpointI_connectors.java b/java/src/IceInternal/EndpointI_connectors.java index cba36c4c7a7..5621d128ecd 100644 --- a/java/src/IceInternal/EndpointI_connectors.java +++ b/java/src/IceInternal/EndpointI_connectors.java @@ -11,6 +11,6 @@ package IceInternal; public interface EndpointI_connectors { - void connectors(java.util.List connectors); + void connectors(java.util.List<Connector> connectors); void exception(Ice.LocalException ex); -}
\ No newline at end of file +} diff --git a/java/src/IceInternal/FixedReference.java b/java/src/IceInternal/FixedReference.java index 6fad0830513..376b42ed1e2 100644 --- a/java/src/IceInternal/FixedReference.java +++ b/java/src/IceInternal/FixedReference.java @@ -15,7 +15,7 @@ public class FixedReference extends Reference FixedReference(Instance instance, Ice.Communicator communicator, Ice.Identity identity, - java.util.Map context, + java.util.Map<String, String> context, String facet, int mode, boolean secure, diff --git a/java/src/IceInternal/Incoming.java b/java/src/IceInternal/Incoming.java index 72fdee73ace..439ccc8dd1d 100644 --- a/java/src/IceInternal/Incoming.java +++ b/java/src/IceInternal/Incoming.java @@ -94,7 +94,7 @@ final public class Incoming extends IncomingBase implements Ice.Request _current.operation = _is.readString(); _current.mode = Ice.OperationMode.convert(_is.readByte()); - _current.ctx = new java.util.HashMap(); + _current.ctx = new java.util.HashMap<String, String>(); int sz = _is.readSize(); while(sz-- > 0) { @@ -279,7 +279,7 @@ final public class Incoming extends IncomingBase implements Ice.Request { if(_interceptorAsyncCallbackList == null) { - _interceptorAsyncCallbackList = new java.util.LinkedList(); + _interceptorAsyncCallbackList = new java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback>(); } _interceptorAsyncCallbackList.addFirst(cb); diff --git a/java/src/IceInternal/IncomingAsync.java b/java/src/IceInternal/IncomingAsync.java index dad81f32ac6..202922117a7 100644 --- a/java/src/IceInternal/IncomingAsync.java +++ b/java/src/IceInternal/IncomingAsync.java @@ -45,7 +45,6 @@ public class IncomingAsync extends IncomingBase in.adopt(this); } - final protected void __response(boolean ok) { @@ -59,10 +58,10 @@ public class IncomingAsync extends IncomingBase if(_response) { _os.endWriteEncaps(); - + int save = _os.pos(); _os.pos(Protocol.headerSize + 4); // Reply status position. - + if(ok) { _os.writeByte(ReplyStatus.replyOK); @@ -71,7 +70,7 @@ public class IncomingAsync extends IncomingBase { _os.writeByte(ReplyStatus.replyUserException); } - + _os.pos(save); _connection.sendResponse(_os, _compress); @@ -90,7 +89,7 @@ public class IncomingAsync extends IncomingBase final protected void __exception(java.lang.Exception exc) { - + try { if(!__servantLocatorFinished()) @@ -147,7 +146,7 @@ public class IncomingAsync extends IncomingBase } } - final protected boolean + final protected boolean __validateResponse(boolean ok) { if(!_retriable) @@ -177,10 +176,10 @@ public class IncomingAsync extends IncomingBase // // interceptorAsyncCallbackList is null or all its elements returned OK - // - + // + synchronized(this) - { + { if(_active) { _active = false; @@ -193,8 +192,7 @@ public class IncomingAsync extends IncomingBase } } - - final protected boolean + final protected boolean __validateException(java.lang.Exception exc) { if(!_retriable) @@ -206,10 +204,10 @@ public class IncomingAsync extends IncomingBase { if(_interceptorAsyncCallbackList != null) { - java.util.Iterator p = _interceptorAsyncCallbackList.iterator(); + java.util.Iterator<Ice.DispatchInterceptorAsyncCallback> p = _interceptorAsyncCallbackList.iterator(); while(p.hasNext()) { - Ice.DispatchInterceptorAsyncCallback cb = (Ice.DispatchInterceptorAsyncCallback)p.next(); + Ice.DispatchInterceptorAsyncCallback cb = p.next(); if(cb.exception(exc) == false) { return false; @@ -224,8 +222,8 @@ public class IncomingAsync extends IncomingBase // // interceptorAsyncCallbackList is null or all its elements returned OK - // - + // + synchronized(this) { if(_active) @@ -240,14 +238,12 @@ public class IncomingAsync extends IncomingBase } } - final protected BasicStream __os() { return _os; } - private final boolean _retriable; private boolean _active = false; // only meaningful when _retriable == true } diff --git a/java/src/IceInternal/IncomingBase.java b/java/src/IceInternal/IncomingBase.java index 6a152c07f83..c2d993f448d 100644 --- a/java/src/IceInternal/IncomingBase.java +++ b/java/src/IceInternal/IncomingBase.java @@ -43,7 +43,8 @@ public class IncomingBase // // Copy, not just reference // - _interceptorAsyncCallbackList = new java.util.LinkedList(in._interceptorAsyncCallbackList); + _interceptorAsyncCallbackList = + new java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback>(in._interceptorAsyncCallbackList); } // @@ -375,5 +376,5 @@ public class IncomingBase protected Ice.ConnectionI _connection; - protected java.util.LinkedList _interceptorAsyncCallbackList; + protected java.util.LinkedList<Ice.DispatchInterceptorAsyncCallback> _interceptorAsyncCallbackList; } diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java index 88e3d5d450c..4efcaf79318 100644 --- a/java/src/IceInternal/IncomingConnectionFactory.java +++ b/java/src/IceInternal/IncomingConnectionFactory.java @@ -32,7 +32,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice public void waitUntilHolding() { - java.util.LinkedList connections; + java.util.LinkedList<Ice.ConnectionI> connections; synchronized(this) { @@ -55,16 +55,16 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // We want to wait until all connections are in holding state // outside the thread synchronization. // - connections = (java.util.LinkedList)_connections.clone(); + connections = new java.util.LinkedList<Ice.ConnectionI>(_connections); } // // Now we wait until each connection is in holding state. // - java.util.ListIterator p = connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)p.next(); + Ice.ConnectionI connection = p.next(); connection.waitUntilHolding(); } } @@ -73,7 +73,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice waitUntilFinished() { Thread threadPerIncomingConnectionFactory = null; - java.util.LinkedList connections = null; + java.util.LinkedList<Ice.ConnectionI> connections = null; synchronized(this) { @@ -106,7 +106,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // if(_connections != null) { - connections = new java.util.LinkedList(_connections); + connections = new java.util.LinkedList<Ice.ConnectionI>(_connections); } } @@ -127,10 +127,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice if(connections != null) { - java.util.ListIterator p = connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)p.next(); + Ice.ConnectionI connection = p.next(); connection.waitUntilFinished(); } } @@ -153,18 +153,18 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice return _endpoint; } - public synchronized java.util.LinkedList + public synchronized java.util.LinkedList<Ice.ConnectionI> connections() { - java.util.LinkedList connections = new java.util.LinkedList(); + java.util.LinkedList<Ice.ConnectionI> connections = new java.util.LinkedList<Ice.ConnectionI>(); // // Only copy connections which have not been destroyed. // - java.util.ListIterator p = _connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = _connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)p.next(); + Ice.ConnectionI connection = p.next(); if(connection.isActiveOrHolding()) { connections.add(connection); @@ -177,12 +177,13 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice public void flushBatchRequests() { - java.util.Iterator p = connections().iterator(); // connections() is synchronized, no need to synchronize here. + java.util.Iterator<Ice.ConnectionI> p = + connections().iterator(); // connections() is synchronized, no need to synchronize here. while(p.hasNext()) { try { - ((Ice.ConnectionI)p.next()).flushBatchRequests(); + p.next().flushBatchRequests(); } catch(Ice.LocalException ex) { @@ -245,10 +246,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // // Reap connections for which destruction has completed. // - java.util.ListIterator p = _connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = _connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI con = (Ice.ConnectionI)p.next(); + Ice.ConnectionI con = p.next(); if(con.isFinished()) { p.remove(); @@ -560,10 +561,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice registerWithPool(); } - java.util.ListIterator p = _connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = _connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)p.next(); + Ice.ConnectionI connection = p.next(); connection.activate(); } break; @@ -580,10 +581,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice unregisterWithPool(); } - java.util.ListIterator p = _connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = _connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)p.next(); + Ice.ConnectionI connection = p.next(); connection.hold(); } break; @@ -614,10 +615,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice } } - java.util.ListIterator p = _connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = _connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)p.next(); + Ice.ConnectionI connection = p.next(); connection.destroy(Ice.ConnectionI.ObjectAdapterDeactivated); } break; @@ -759,10 +760,10 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice // // Reap connections for which destruction has completed. // - java.util.ListIterator p = _connections.listIterator(); + java.util.ListIterator<Ice.ConnectionI> p = _connections.listIterator(); while(p.hasNext()) { - Ice.ConnectionI con = (Ice.ConnectionI)p.next(); + Ice.ConnectionI con = p.next(); if(con.isFinished()) { p.remove(); @@ -836,7 +837,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice private final boolean _warn; - private java.util.LinkedList _connections = new java.util.LinkedList(); + private java.util.List<Ice.ConnectionI> _connections = new java.util.LinkedList<Ice.ConnectionI>(); private int _state; diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index 307e7c001c0..b14f46db598 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -279,7 +279,7 @@ public final class Instance } public synchronized void - setDefaultContext(java.util.Map ctx) + setDefaultContext(java.util.Map<String, String> ctx) { if(_state == StateDestroyed) { @@ -292,11 +292,11 @@ public final class Instance } else { - _defaultContext = new java.util.HashMap(ctx); + _defaultContext = new java.util.HashMap<String, String>(ctx); } } - public synchronized java.util.Map + public synchronized java.util.Map<String, String> getDefaultContext() { if(_state == StateDestroyed) @@ -304,7 +304,7 @@ public final class Instance throw new Ice.CommunicatorDestroyedException(); } - return new java.util.HashMap(_defaultContext); + return new java.util.HashMap<String, String>(_defaultContext); } public Ice.ImplicitContextI @@ -400,15 +400,15 @@ public final class Instance // // Add all facets to OA // - java.util.Map filteredFacets = new java.util.HashMap(); - java.util.Iterator p = _adminFacets.entrySet().iterator(); + java.util.Map<String, Ice.Object> filteredFacets = new java.util.HashMap<String, Ice.Object>(); + java.util.Iterator<java.util.Map.Entry<String, Ice.Object> > p = _adminFacets.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); + java.util.Map.Entry<String, Ice.Object> entry = p.next(); - if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains((String)entry.getKey())) + if(_adminFacetFilter.isEmpty() || _adminFacetFilter.contains(entry.getKey())) { - _adminAdapter.addFacet((Ice.Object)entry.getValue(), _adminIdentity, (String)entry.getKey()); + _adminAdapter.addFacet(entry.getValue(), _adminIdentity, entry.getKey()); } else { @@ -523,7 +523,7 @@ public final class Instance Ice.Object result = null; if(_adminAdapter == null || (!_adminFacetFilter.isEmpty() && !_adminFacetFilter.contains(facet))) { - result = (Ice.Object)_adminFacets.remove(facet); + result = _adminFacets.remove(facet); if(result == null) { @@ -1014,14 +1014,14 @@ public final class Instance if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0) { - java.util.List unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties(); + java.util.List<String> unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties(); if(unusedProperties.size() != 0) { String message = "The following properties were set but never read:"; - java.util.Iterator p = unusedProperties.iterator(); + java.util.Iterator<String> p = unusedProperties.iterator(); while(p.hasNext()) { - message += "\n " + (String)p.next(); + message += "\n " + p.next(); } _initData.logger.warning(message); } @@ -1032,13 +1032,13 @@ public final class Instance validatePackages() { final String prefix = "Ice.Package."; - java.util.Map map = _initData.properties.getPropertiesForPrefix(prefix); - java.util.Iterator p = map.entrySet().iterator(); + java.util.Map<String, String> map = _initData.properties.getPropertiesForPrefix(prefix); + java.util.Iterator<java.util.Map.Entry<String, String> > p = map.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry e = (java.util.Map.Entry)p.next(); - String key = (String)e.getKey(); - String pkg = (String)e.getValue(); + java.util.Map.Entry<String, String> e = p.next(); + String key = e.getKey(); + String pkg = e.getValue(); if(key.length() == prefix.length()) { _initData.logger.warning("ignoring invalid property: " + key + "=" + pkg); @@ -1087,14 +1087,14 @@ public final class Instance private final boolean _background; private EndpointFactoryManager _endpointFactoryManager; private Ice.PluginManager _pluginManager; - private java.util.Map _defaultContext; + private java.util.Map<String, String> _defaultContext; private Ice.ObjectAdapter _adminAdapter; - private java.util.Map _adminFacets = new java.util.HashMap(); - private java.util.Set _adminFacetFilter = new java.util.HashSet(); + private java.util.Map<String, Ice.Object> _adminFacets = new java.util.HashMap<String, Ice.Object>(); + private java.util.Set<String> _adminFacetFilter = new java.util.HashSet<String>(); private Ice.Identity _adminIdentity; - private static java.util.Map _emptyContext = new java.util.HashMap(); + private static java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>(); private static boolean _oneOffDone = false; } diff --git a/java/src/IceInternal/IntMap.java b/java/src/IceInternal/IntMap.java deleted file mode 100755 index eb2c0a5fa5e..00000000000 --- a/java/src/IceInternal/IntMap.java +++ /dev/null @@ -1,389 +0,0 @@ -// ********************************************************************** -// -// Copyright (c) 2003-2008 ZeroC, Inc. All rights reserved. -// -// This copy of Ice is licensed to you under the terms described in the -// ICE_LICENSE file included in this distribution. -// -// ********************************************************************** - -package IceInternal; - -public class IntMap -{ - public - IntMap(int initialCapacity, float loadFactor) - { - if(initialCapacity > MAXIMUM_CAPACITY) - { - initialCapacity = MAXIMUM_CAPACITY; - } - - // Find a power of 2 >= initialCapacity - int capacity = 1; - while(capacity < initialCapacity) - { - capacity <<= 1; - } - - _loadFactor = loadFactor; - _threshold = (int)(capacity * loadFactor); - _table = new Entry[capacity]; - } - - public - IntMap(int initialCapacity) - { - this(initialCapacity, DEFAULT_LOAD_FACTOR); - } - - public - IntMap() - { - _loadFactor = DEFAULT_LOAD_FACTOR; - _threshold = (int)(DEFAULT_INITIAL_CAPACITY); - _table = new Entry[DEFAULT_INITIAL_CAPACITY]; - } - - public int - size() - { - return _size; - } - - public boolean - isEmpty() - { - return _size == 0; - } - - public Object - get(int key) - { - int i = indexFor(key, _table.length); - Entry e = _table[i]; - while(true) - { - if(e == null) - { - return e; - } - if(key == e.key) - { - return e.value; - } - e = e.next; - } - } - - public boolean - containsKey(int key) - { - int i = indexFor(key, _table.length); - Entry e = _table[i]; - while(e != null) - { - if(key == e.key) - { - return true; - } - e = e.next; - } - return false; - } - - public Object - put(int key, Object value) - { - int i = indexFor(key, _table.length); - - for(Entry e = _table[i]; e != null; e = e.next) - { - if(key == e.key) - { - Object oldValue = e.value; - e.value = value; - return oldValue; - } - } - - _modCount++; - addEntry(key, value, i); - return null; - } - - public Object - remove(int key) - { - int i = indexFor(key, _table.length); - Entry prev = _table[i]; - Entry e = prev; - - while(e != null) - { - Entry next = e.next; - if(key == e.key) - { - _modCount++; - _size--; - if(prev == e) - { - _table[i] = next; - } - else - { - prev.next = next; - } - e.next = _entryCache; - _entryCache = e; - return e.value; - } - prev = e; - e = next; - } - - return (e == null ? e : e.value); - } - - public void - clear() - { - _modCount++; - Entry tab[] = _table; - for(int i = 0; i < tab.length; i++) - { - tab[i] = null; - } - _size = 0; - } - - public java.util.Iterator - entryIterator() - { - return new EntryIterator(); - } - - public static final class Entry - { - int key; - Object value; - Entry next; - - Entry(int k, Object v, Entry n) - { - key = k; - value = v; - next = n; - } - - public int - getKey() - { - return key; - } - - public Object - getValue() - { - return value; - } - - public Object - setValue(Object newValue) - { - Object oldValue = value; - value = newValue; - return oldValue; - } - } - - private static int - indexFor(int key, int length) - { - return key & (length - 1); - } - - private void - addEntry(int key, Object value, int bucketIndex) - { - Entry e; - if(_entryCache != null) - { - e = _entryCache; - _entryCache = _entryCache.next; - e.key = key; - e.value = value; - e.next = _table[bucketIndex]; - } - else - { - e = new Entry(key, value, _table[bucketIndex]); - } - _table[bucketIndex] = e; - if(_size++ >= _threshold) - { - resize(2 * _table.length); - } - } - - private void - resize(int newCapacity) - { - // assert (newCapacity & -newCapacity) == newCapacity; // power of 2 - Entry[] oldTable = _table; - int oldCapacity = oldTable.length; - - // check if needed - if(_size < _threshold || oldCapacity > newCapacity) - { - return; - } - - Entry[] newTable = new Entry[newCapacity]; - transfer(newTable); - _table = newTable; - _threshold = (int)(newCapacity * _loadFactor); - } - - private void - transfer(Entry[] newTable) - { - Entry[] src = _table; - int newCapacity = newTable.length; - for(int j = 0; j < src.length; j++) - { - Entry e = src[j]; - if(e != null) - { - src[j] = null; - do - { - Entry next = e.next; - int i = indexFor(e.key, newCapacity); - e.next = newTable[i]; - newTable[i] = e; - e = next; - } - while(e != null); - } - } - } - - private class EntryIterator implements java.util.Iterator - { - EntryIterator() - { - _expectedModCount = _modCount; - Entry[] t = _table; - int i = t.length; - Entry n = null; - if(_size != 0) // advance to first entry - { - while(i > 0 && (n = t[--i]) == null) - ; - } - _next = n; - _index = i; - } - - public boolean - hasNext() - { - return _next != null; - } - - public Object - next() - { - if(_modCount != _expectedModCount) - { - throw new java.util.ConcurrentModificationException(); - } - Entry e = _next; - if(e == null) - { - throw new java.util.NoSuchElementException(); - } - - Entry n = e.next; - Entry[] t = _table; - int i = _index; - while(n == null && i > 0) - { - n = t[--i]; - } - _index = i; - _next = n; - return _current = e; - } - - public void - remove() - { - if(_current == null) - { - throw new IllegalStateException(); - } - if(_modCount != _expectedModCount) - { - throw new java.util.ConcurrentModificationException(); - } - int k = _current.key; - _current = null; - IntMap.this.remove(k); - _expectedModCount = _modCount; - } - - private Entry _next; - private int _expectedModCount; - private int _index; - private Entry _current; - } - - // - // The default initial capacity - MUST be a power of two. - // - private static final int DEFAULT_INITIAL_CAPACITY = 16; - - // - // The maximum capacity, used if a higher value is implicitly specified - // by either of the constructors with arguments. - // MUST be a power of two <= 1<<30. - // - private static final int MAXIMUM_CAPACITY = 1 << 30; - - // - // The default load factor. - // - private static final float DEFAULT_LOAD_FACTOR = 0.75f; - - // - // The table, resized as necessary. Length MUST Always be a power of two. - // - private Entry[] _table; - - // - // The number of key-value mappings contained in this map. - // - private int _size; - - // - // The next size value at which to resize (capacity * load factor). - // - private int _threshold; - - // - // The load factor for the hash table. - // - private final float _loadFactor; - - // - // The number of times this map has been structurally modified - // Structural modifications are those that change the number of - // mappings in the map or otherwise modify its internal structure - // (e.g., rehash). This field is used to make iterators fail-fast. - // - private volatile int _modCount; - - private Entry _entryCache; -} diff --git a/java/src/IceInternal/ListPatcher.java b/java/src/IceInternal/ListPatcher.java index 37b8713b68b..6d1dfd16280 100644 --- a/java/src/IceInternal/ListPatcher.java +++ b/java/src/IceInternal/ListPatcher.java @@ -9,10 +9,10 @@ package IceInternal; -public class ListPatcher implements Patcher, Ice.ReadObjectCallback +public class ListPatcher<T> implements Patcher, Ice.ReadObjectCallback { public - ListPatcher(java.util.List list, Class cls, String type, int index) + ListPatcher(java.util.List<T> list, Class<T> cls, String type, int index) { _list = list; _cls = cls; @@ -40,7 +40,7 @@ public class ListPatcher implements Patcher, Ice.ReadObjectCallback // isn't much we can do about it as long as a new patcher instance is // created for each element. // - _list.set(_index, v); + _list.set(_index, _cls.cast(v)); } public String @@ -55,8 +55,8 @@ public class ListPatcher implements Patcher, Ice.ReadObjectCallback patch(v); } - private java.util.List _list; - private Class _cls; + private java.util.List<T> _list; + private Class<T> _cls; private String _type; private int _index; } diff --git a/java/src/IceInternal/LocatorManager.java b/java/src/IceInternal/LocatorManager.java index 72f9a54dada..d45d4bff34a 100644 --- a/java/src/IceInternal/LocatorManager.java +++ b/java/src/IceInternal/LocatorManager.java @@ -18,10 +18,10 @@ public final class LocatorManager synchronized void destroy() { - java.util.Iterator i = _table.values().iterator(); + java.util.Iterator<LocatorInfo> i = _table.values().iterator(); while(i.hasNext()) { - LocatorInfo info = (LocatorInfo)i.next(); + LocatorInfo info = i.next(); info.destroy(); } _table.clear(); @@ -51,7 +51,7 @@ public final class LocatorManager synchronized(this) { - LocatorInfo info = (LocatorInfo)_table.get(locator); + LocatorInfo info = _table.get(locator); if(info == null) { // @@ -59,7 +59,7 @@ public final class LocatorManager // have only one table per locator (not one per locator // proxy). // - LocatorTable table = (LocatorTable)_locatorTables.get(locator.ice_getIdentity()); + LocatorTable table = _locatorTables.get(locator.ice_getIdentity()); if(table == null) { table = new LocatorTable(); @@ -74,6 +74,8 @@ public final class LocatorManager } } - private java.util.HashMap _table = new java.util.HashMap(); - private java.util.HashMap _locatorTables = new java.util.HashMap(); + private java.util.HashMap<Ice.LocatorPrx, LocatorInfo> _table = + new java.util.HashMap<Ice.LocatorPrx, LocatorInfo>(); + private java.util.HashMap<Ice.Identity, LocatorTable> _locatorTables = + new java.util.HashMap<Ice.Identity, LocatorTable>(); } diff --git a/java/src/IceInternal/LocatorTable.java b/java/src/IceInternal/LocatorTable.java index 87bd5f4af0e..1e8568fe703 100644 --- a/java/src/IceInternal/LocatorTable.java +++ b/java/src/IceInternal/LocatorTable.java @@ -30,7 +30,7 @@ final class LocatorTable return null; } - EndpointTableEntry entry = (EndpointTableEntry)_adapterEndpointsTable.get(adapter); + EndpointTableEntry entry = _adapterEndpointsTable.get(adapter); if(entry != null && checkTTL(entry.time, ttl)) { return entry.endpoints; @@ -48,7 +48,7 @@ final class LocatorTable synchronized IceInternal.EndpointI[] removeAdapterEndpoints(String adapter) { - EndpointTableEntry entry = (EndpointTableEntry)_adapterEndpointsTable.remove(adapter); + EndpointTableEntry entry = _adapterEndpointsTable.remove(adapter); return entry != null ? entry.endpoints : null; } @@ -60,7 +60,7 @@ final class LocatorTable return null; } - ProxyTableEntry entry = (ProxyTableEntry)_objectTable.get(id); + ProxyTableEntry entry = _objectTable.get(id); if(entry != null && checkTTL(entry.time, ttl)) { return entry.proxy; @@ -77,7 +77,7 @@ final class LocatorTable synchronized Ice.ObjectPrx removeProxy(Ice.Identity id) { - ProxyTableEntry entry = (ProxyTableEntry)_objectTable.remove(id); + ProxyTableEntry entry = _objectTable.remove(id); return entry != null ? entry.proxy : null; } @@ -105,7 +105,7 @@ final class LocatorTable final public long time; final public IceInternal.EndpointI[] endpoints; - }; + } private static final class ProxyTableEntry { @@ -117,9 +117,10 @@ final class LocatorTable final public long time; final public Ice.ObjectPrx proxy; - }; + } - private java.util.HashMap _adapterEndpointsTable = new java.util.HashMap(); - private java.util.HashMap _objectTable = new java.util.HashMap(); + private java.util.Map<String, EndpointTableEntry> _adapterEndpointsTable = + new java.util.HashMap<String, EndpointTableEntry>(); + private java.util.Map<Ice.Identity, ProxyTableEntry> _objectTable = + new java.util.HashMap<Ice.Identity, ProxyTableEntry>(); } - diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java index 07a86633166..84775bb76b7 100644 --- a/java/src/IceInternal/Network.java +++ b/java/src/IceInternal/Network.java @@ -833,11 +833,11 @@ public final class Network // Iterate over the network interfaces and pick an IP // address (preferably not the loopback address). // - java.util.ArrayList addrs = getLocalAddresses(protocol); - java.util.Iterator iter = addrs.iterator(); + java.util.ArrayList<java.net.InetAddress> addrs = getLocalAddresses(protocol); + java.util.Iterator<java.net.InetAddress> iter = addrs.iterator(); while(addr == null && iter.hasNext()) { - java.net.InetAddress a = (java.net.InetAddress)iter.next(); + java.net.InetAddress a = iter.next(); if(protocol == EnableBoth || (protocol == EnableIPv4 && a instanceof java.net.Inet4Address) || (protocol == EnableIPv6 && a instanceof java.net.Inet6Address)) @@ -856,10 +856,11 @@ public final class Network return addr; } - public static java.util.ArrayList + public static java.util.ArrayList<java.net.InetSocketAddress> getAddresses(String host, int port, int protocol) { - java.util.ArrayList addresses = new java.util.ArrayList(); + java.util.ArrayList<java.net.InetSocketAddress> addresses = + new java.util.ArrayList<java.net.InetSocketAddress>(); try { java.net.InetAddress[] addrs; @@ -902,20 +903,20 @@ public final class Network return addresses; } - public static java.util.ArrayList + public static java.util.ArrayList<java.net.InetAddress> getLocalAddresses(int protocol) { - java.util.ArrayList result = new java.util.ArrayList(); + java.util.ArrayList<java.net.InetAddress> result = new java.util.ArrayList<java.net.InetAddress>(); try { - java.util.Enumeration ifaces = java.net.NetworkInterface.getNetworkInterfaces(); + java.util.Enumeration<java.net.NetworkInterface> ifaces = java.net.NetworkInterface.getNetworkInterfaces(); while(ifaces.hasMoreElements()) { - java.net.NetworkInterface iface = (java.net.NetworkInterface)ifaces.nextElement(); - java.util.Enumeration addrs = iface.getInetAddresses(); + java.net.NetworkInterface iface = ifaces.nextElement(); + java.util.Enumeration<java.net.InetAddress> addrs = iface.getInetAddresses(); while(addrs.hasMoreElements()) { - java.net.InetAddress addr = (java.net.InetAddress)addrs.nextElement(); + java.net.InetAddress addr = addrs.nextElement(); if(!addr.isLoopbackAddress()) { if(protocol == EnableBoth || @@ -1003,7 +1004,7 @@ public final class Network return fds; } - public static java.util.ArrayList + public static java.util.ArrayList<String> getHostsForEndpointExpand(String host, int protocolSupport) { boolean wildcard = (host == null || host.length() == 0); @@ -1018,18 +1019,18 @@ public final class Network } } - java.util.ArrayList hosts = new java.util.ArrayList(); + java.util.ArrayList<String> hosts = new java.util.ArrayList<String>(); if(wildcard) { - java.util.ArrayList addrs = getLocalAddresses(protocolSupport); - java.util.Iterator p = addrs.iterator(); + java.util.ArrayList<java.net.InetAddress> addrs = getLocalAddresses(protocolSupport); + java.util.Iterator<java.net.InetAddress> p = addrs.iterator(); while(p.hasNext()) { // // NOTE: We don't publish link-local IPv6 addresses as these addresses can only // be accessed in general with a scope-id. // - java.net.InetAddress addr = (java.net.InetAddress)p.next(); + java.net.InetAddress addr = p.next(); if(!addr.isLinkLocalAddress()) { hosts.add(addr.getHostAddress()); diff --git a/java/src/IceInternal/ObjectAdapterFactory.java b/java/src/IceInternal/ObjectAdapterFactory.java index f611ecd42ae..9dd4779930f 100644 --- a/java/src/IceInternal/ObjectAdapterFactory.java +++ b/java/src/IceInternal/ObjectAdapterFactory.java @@ -14,7 +14,7 @@ public final class ObjectAdapterFactory public void shutdown() { - java.util.HashMap adapters; + java.util.Map<String, Ice.ObjectAdapterI> adapters; synchronized(this) { // @@ -40,10 +40,10 @@ public final class ObjectAdapterFactory // if(adapters != null) { - java.util.Iterator i = adapters.values().iterator(); + java.util.Iterator<Ice.ObjectAdapterI> i = adapters.values().iterator(); while(i.hasNext()) { - Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.next(); + Ice.ObjectAdapter adapter = i.next(); adapter.deactivate(); } } @@ -52,7 +52,7 @@ public final class ObjectAdapterFactory public void waitForShutdown() { - java.util.HashMap adapters; + java.util.Map<String, Ice.ObjectAdapterI> adapters; synchronized(this) { // @@ -92,10 +92,10 @@ public final class ObjectAdapterFactory // if(adapters != null) { - java.util.Iterator i = adapters.values().iterator(); + java.util.Iterator<Ice.ObjectAdapterI> i = adapters.values().iterator(); while(i.hasNext()) { - Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.next(); + Ice.ObjectAdapter adapter = i.next(); adapter.waitForDeactivate(); } } @@ -124,7 +124,7 @@ public final class ObjectAdapterFactory // waitForShutdown(); - java.util.HashMap adapters; + java.util.Map<String, Ice.ObjectAdapterI> adapters; synchronized(this) { adapters = _adapters; @@ -142,10 +142,10 @@ public final class ObjectAdapterFactory // if(adapters != null) { - java.util.Iterator i = adapters.values().iterator(); + java.util.Iterator<Ice.ObjectAdapterI> i = adapters.values().iterator(); while(i.hasNext()) { - Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.next(); + Ice.ObjectAdapter adapter = i.next(); adapter.destroy(); } } @@ -159,7 +159,7 @@ public final class ObjectAdapterFactory throw new Ice.ObjectAdapterDeactivatedException(); } - Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)_adapters.get(name); + Ice.ObjectAdapterI adapter = _adapters.get(name); if(adapter != null) { throw new Ice.AlreadyRegisteredException("object adapter", name); @@ -189,7 +189,7 @@ public final class ObjectAdapterFactory public Ice.ObjectAdapter findObjectAdapter(Ice.ObjectPrx proxy) { - java.util.ArrayList adapters; + java.util.List<Ice.ObjectAdapterI> adapters; synchronized(this) { if(_instance == null) @@ -197,15 +197,15 @@ public final class ObjectAdapterFactory return null; } - adapters = new java.util.ArrayList(_adapters.values()); + adapters = new java.util.ArrayList<Ice.ObjectAdapterI>(_adapters.values()); } - java.util.Iterator p = adapters.iterator(); + java.util.Iterator<Ice.ObjectAdapterI> p = adapters.iterator(); while(p.hasNext()) { try { - Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)p.next(); + Ice.ObjectAdapterI adapter = p.next(); if(adapter.isLocal(proxy)) { return adapter; @@ -234,7 +234,7 @@ public final class ObjectAdapterFactory public void flushBatchRequests() { - java.util.ArrayList adapters; + java.util.List<Ice.ObjectAdapterI> adapters; synchronized(this) { if(_adapters == null) @@ -242,13 +242,13 @@ public final class ObjectAdapterFactory return; } - adapters = new java.util.ArrayList(_adapters.values()); + adapters = new java.util.ArrayList<Ice.ObjectAdapterI>(_adapters.values()); } - java.util.Iterator p = adapters.iterator(); + java.util.Iterator<Ice.ObjectAdapterI> p = adapters.iterator(); while(p.hasNext()) { - ((Ice.ObjectAdapterI)p.next()).flushBatchRequests(); + p.next().flushBatchRequests(); } } @@ -276,6 +276,6 @@ public final class ObjectAdapterFactory private Instance _instance; private Ice.Communicator _communicator; - private java.util.HashMap _adapters = new java.util.HashMap(); + private java.util.Map<String, Ice.ObjectAdapterI> _adapters = new java.util.HashMap<String, Ice.ObjectAdapterI>(); private boolean _waitForShutdown; } diff --git a/java/src/IceInternal/ObjectFactoryManager.java b/java/src/IceInternal/ObjectFactoryManager.java index f7ed4f3492c..7e50cc43f2c 100644 --- a/java/src/IceInternal/ObjectFactoryManager.java +++ b/java/src/IceInternal/ObjectFactoryManager.java @@ -28,12 +28,12 @@ public final class ObjectFactoryManager public void remove(String id) { - Object o = null; + Ice.ObjectFactory factory = null; synchronized(this) { - o = _factoryMap.get(id); - if(o == null) + factory = _factoryMap.get(id); + if(factory == null) { Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); ex.id = id; @@ -43,13 +43,13 @@ public final class ObjectFactoryManager _factoryMap.remove(id); } - ((Ice.ObjectFactory)o).destroy(); + factory.destroy(); } public synchronized Ice.ObjectFactory find(String id) { - return (Ice.ObjectFactory)_factoryMap.get(id); + return _factoryMap.get(id); } // @@ -62,20 +62,21 @@ public final class ObjectFactoryManager void destroy() { - java.util.Map oldMap = null; + java.util.Map<String, Ice.ObjectFactory> oldMap = null; synchronized(this) { oldMap = _factoryMap; - _factoryMap = new java.util.HashMap(); + _factoryMap = new java.util.HashMap<String, Ice.ObjectFactory>(); } - java.util.Iterator i = oldMap.values().iterator(); + java.util.Iterator<Ice.ObjectFactory> i = oldMap.values().iterator(); while(i.hasNext()) { - Ice.ObjectFactory factory = (Ice.ObjectFactory)i.next(); + Ice.ObjectFactory factory = i.next(); factory.destroy(); } } - private java.util.HashMap _factoryMap = new java.util.HashMap(); + private java.util.Map<String, Ice.ObjectFactory> _factoryMap = + new java.util.HashMap<String, Ice.ObjectFactory>(); } diff --git a/java/src/IceInternal/Outgoing.java b/java/src/IceInternal/Outgoing.java index 89734a36c96..a454993f852 100644 --- a/java/src/IceInternal/Outgoing.java +++ b/java/src/IceInternal/Outgoing.java @@ -12,7 +12,7 @@ package IceInternal; public final class Outgoing implements OutgoingMessageCallback { public - Outgoing(RequestHandler handler, String operation, Ice.OperationMode mode, java.util.Map context) + Outgoing(RequestHandler handler, String operation, Ice.OperationMode mode, java.util.Map<String, String> context) throws LocalExceptionWrapper { _state = StateUnsent; @@ -30,7 +30,7 @@ public final class Outgoing implements OutgoingMessageCallback // These functions allow this object to be reused, rather than reallocated. // public void - reset(RequestHandler handler, String operation, Ice.OperationMode mode, java.util.Map context) + reset(RequestHandler handler, String operation, Ice.OperationMode mode, java.util.Map<String, String> context) throws LocalExceptionWrapper { _state = StateUnsent; @@ -449,7 +449,7 @@ public final class Outgoing implements OutgoingMessageCallback } private void - writeHeader(String operation, Ice.OperationMode mode, java.util.Map context) + writeHeader(String operation, Ice.OperationMode mode, java.util.Map<String, String> context) throws LocalExceptionWrapper { switch(_handler.getReference().getMode()) @@ -505,7 +505,7 @@ public final class Outgoing implements OutgoingMessageCallback // Implicit context // Ice.ImplicitContextI implicitContext = _handler.getReference().getInstance().getImplicitContext(); - java.util.Map prxContext = _handler.getReference().getContext(); + java.util.Map<String, String> prxContext = _handler.getReference().getContext(); if(implicitContext == null) { diff --git a/java/src/IceInternal/OutgoingAsync.java b/java/src/IceInternal/OutgoingAsync.java index 463a0643844..31bf5557462 100644 --- a/java/src/IceInternal/OutgoingAsync.java +++ b/java/src/IceInternal/OutgoingAsync.java @@ -18,8 +18,8 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback { _sent = true; - if(!_proxy.ice_isTwoway()) - { + if(!_proxy.ice_isTwoway()) + { __release(); } else if(_response) @@ -31,14 +31,14 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback assert(_timerTask == null); _timerTask = new TimerTask() { - public void - runTimerTask() - { - __runTimerTask(connection); - } - }; - _proxy.__reference().getInstance().timer().schedule(_timerTask, connection.timeout()); - } + public void + runTimerTask() + { + __runTimerTask(connection); + } + }; + _proxy.__reference().getInstance().timer().schedule(_timerTask, connection.timeout()); + } } } @@ -46,7 +46,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback __finished(BasicStream is) { assert(_proxy.ice_isTwoway()); // Can only be called for twoways. - + byte replyStatus; try { @@ -59,7 +59,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback { _timerTask = null; // Timer cancelled. } - + while(!_sent || _timerTask != null) { try @@ -193,9 +193,9 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback __finished(ex); return; } - + assert(replyStatus == ReplyStatus.replyOK || replyStatus == ReplyStatus.replyUserException); - + try { __response(replyStatus == ReplyStatus.replyOK); @@ -219,7 +219,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback { _timerTask = null; // Timer cancelled. } - + while(_timerTask != null) { try @@ -232,7 +232,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback } } } - + // // NOTE: at this point, synchronization isn't needed, no other threads should be // calling on the callback. @@ -272,7 +272,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback } protected final void - __prepare(Ice.ObjectPrx prx, String operation, Ice.OperationMode mode, java.util.Map context) + __prepare(Ice.ObjectPrx prx, String operation, Ice.OperationMode mode, java.util.Map<String, String> context) { assert(__os != null); @@ -280,7 +280,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback _delegate = null; _cnt = 0; _mode = mode; - + // // Can't call async via a batch proxy. // @@ -288,13 +288,13 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback { throw new Ice.FeatureNotSupportedException("can't send batch requests with AMI"); } - + __os.writeBlob(IceInternal.Protocol.requestHdr); - + Reference ref = _proxy.__reference(); ref.getIdentity().__write(__os); - + // // For compatibility with the old FacetPath. // @@ -308,11 +308,11 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback String[] facetPath = { facet }; __os.writeStringSeq(facetPath); } - + __os.writeString(operation); - + __os.writeByte((byte)mode.value()); - + if(context != null) { // @@ -326,8 +326,8 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback // Implicit context // Ice.ImplicitContextI implicitContext = ref.getInstance().getImplicitContext(); - java.util.Map prxContext = ref.getContext(); - + java.util.Map<String, String> prxContext = ref.getContext(); + if(implicitContext == null) { Ice.ContextHelper.write(__os, prxContext); @@ -337,7 +337,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback implicitContext.write(prxContext, __os); } } - + __os.startWriteEncaps(); } @@ -367,7 +367,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback protected abstract void __response(boolean ok); - protected void + protected void __throwUserException() throws Ice.UserException { @@ -407,20 +407,20 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback // close connection message, the server guarantees that all outstanding requests // can safely be repeated. // - // An ObjectNotExistException can always be retried as well without violating + // An ObjectNotExistException can always be retried as well without violating // "at-most-once" (see the implementation of the checkRetryAfterException method of // the ProxyFactory class for the reasons why it can be useful). - // - if(!_sent || - exc instanceof Ice.CloseConnectionException || + // + if(!_sent || + exc instanceof Ice.CloseConnectionException || exc instanceof Ice.ObjectNotExistException) { throw exc; } - + // - // Throw the exception wrapped in a LocalExceptionWrapper, to indicate that the - // request cannot be resent without potentially violating the "at-most-once" + // Throw the exception wrapped in a LocalExceptionWrapper, to indicate that the + // request cannot be resent without potentially violating the "at-most-once" // principle. // throw new LocalExceptionWrapper(exc, false); @@ -448,7 +448,7 @@ public abstract class OutgoingAsync extends OutgoingAsyncMessageCallback synchronized(__monitor) { assert(_timerTask != null && _sent); // Can only be set once the request is sent. - + if(_response) // If the response was just received, don't close the connection. { connection = null; diff --git a/java/src/IceInternal/OutgoingConnectionFactory.java b/java/src/IceInternal/OutgoingConnectionFactory.java index 94f6bc1c078..fec7e825ab0 100644 --- a/java/src/IceInternal/OutgoingConnectionFactory.java +++ b/java/src/IceInternal/OutgoingConnectionFactory.java @@ -25,15 +25,15 @@ public final class OutgoingConnectionFactory return; } - java.util.Iterator p = _connections.values().iterator(); + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator(); while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); + java.util.List<Ice.ConnectionI> connectionList = p.next(); - java.util.Iterator q = connectionList.iterator(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)q.next(); + Ice.ConnectionI connection = q.next(); connection.destroy(Ice.ConnectionI.CommunicatorDestroyed); } } @@ -45,7 +45,7 @@ public final class OutgoingConnectionFactory public void waitUntilFinished() { - java.util.HashMap connections = null; + java.util.Map<ConnectorInfo, java.util.List<Ice.ConnectionI> > connections = null; synchronized(this) { @@ -72,22 +72,23 @@ public final class OutgoingConnectionFactory // if(_connections != null) { - connections = new java.util.HashMap(_connections); + connections = + new java.util.HashMap<ConnectorInfo, java.util.List<Ice.ConnectionI> >(_connections); } } // // Now we wait until the destruction of each connection is finished. // - java.util.Iterator p = connections.values().iterator(); + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = connections.values().iterator(); while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); + java.util.List<Ice.ConnectionI> connectionList = p.next(); - java.util.Iterator q = connectionList.iterator(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)q.next(); + Ice.ConnectionI connection = q.next(); connection.waitUntilFinished(); } } @@ -113,7 +114,7 @@ public final class OutgoingConnectionFactory // // Apply the overrides. // - java.util.List endpoints = applyOverrides(endpts); + java.util.List<EndpointI> endpoints = applyOverrides(endpts); // // Try to find a connection to one of the given endpoints. @@ -130,18 +131,18 @@ public final class OutgoingConnectionFactory // If we didn't find a connection with the endpoints, we create the connectors // for the endpoints. // - java.util.ArrayList connectors = new java.util.ArrayList(); - java.util.Iterator p = endpoints.iterator(); + java.util.List<ConnectorInfo> connectors = new java.util.ArrayList<ConnectorInfo>(); + java.util.Iterator<EndpointI> p = endpoints.iterator(); while(p.hasNext()) { - EndpointI endpoint = (EndpointI)p.next(); + EndpointI endpoint = p.next(); // // Create connectors for the endpoint. // try { - java.util.List cons = endpoint.connectors(); + java.util.List<Connector> cons = endpoint.connectors(); assert(cons.size() > 0); // @@ -152,10 +153,10 @@ public final class OutgoingConnectionFactory java.util.Collections.shuffle(cons); } - java.util.Iterator q = cons.iterator(); + java.util.Iterator<Connector> q = cons.iterator(); while(q.hasNext()) { - connectors.add(new ConnectorInfo((Connector)q.next(), endpoint, tpc)); + connectors.add(new ConnectorInfo(q.next(), endpoint, tpc)); } } catch(Ice.LocalException ex) @@ -187,10 +188,10 @@ public final class OutgoingConnectionFactory // Try to establish the connection to the connectors. // DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - p = connectors.iterator(); - while(p.hasNext()) + java.util.Iterator<ConnectorInfo> q = connectors.iterator(); + while(q.hasNext()) { - ConnectorInfo ci = (ConnectorInfo)p.next(); + ConnectorInfo ci = q.next(); try { int timeout; @@ -260,7 +261,7 @@ public final class OutgoingConnectionFactory // // Apply the overrides. // - java.util.List endpoints = applyOverrides(endpts); + java.util.List<EndpointI> endpoints = applyOverrides(endpts); // // Try to find a connection to one of the given endpoints. @@ -327,15 +328,15 @@ public final class OutgoingConnectionFactory // endpoint = endpoint.compress(false); - java.util.Iterator p = _connections.values().iterator(); + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator(); while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); - - java.util.Iterator q = connectionList.iterator(); + java.util.List<Ice.ConnectionI> connectionList = p.next(); + + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)q.next(); + Ice.ConnectionI connection = q.next(); if(connection.endpoint() == endpoint) { try @@ -362,15 +363,15 @@ public final class OutgoingConnectionFactory return; } - java.util.Iterator p = _connections.values().iterator(); + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator(); while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); + java.util.List<Ice.ConnectionI> connectionList = p.next(); - java.util.Iterator q = connectionList.iterator(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)q.next(); + Ice.ConnectionI connection = q.next(); if(connection.getAdapter() == adapter) { try @@ -391,15 +392,15 @@ public final class OutgoingConnectionFactory public void flushBatchRequests() { - java.util.LinkedList c = new java.util.LinkedList(); + java.util.List<Ice.ConnectionI> c = new java.util.LinkedList<Ice.ConnectionI>(); synchronized(this) { - java.util.Iterator p = _connections.values().iterator(); + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator(); while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); - java.util.Iterator q = connectionList.iterator(); + java.util.List<Ice.ConnectionI> connectionList = p.next(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { c.add(q.next()); @@ -407,10 +408,10 @@ public final class OutgoingConnectionFactory } } - java.util.Iterator p = c.iterator(); + java.util.Iterator<Ice.ConnectionI> p = c.iterator(); while(p.hasNext()) { - Ice.ConnectionI conn = (Ice.ConnectionI)p.next(); + Ice.ConnectionI conn = p.next(); try { conn.flushBatchRequests(); @@ -444,11 +445,11 @@ public final class OutgoingConnectionFactory super.finalize(); } - private java.util.List + private java.util.List<EndpointI> applyOverrides(EndpointI[] endpts) { DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - java.util.ArrayList endpoints = new java.util.ArrayList(); + java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); for(int i = 0; i < endpts.length; i++) { // @@ -468,7 +469,7 @@ public final class OutgoingConnectionFactory } synchronized private Ice.ConnectionI - findConnection(java.util.List endpoints, boolean tpc, Ice.BooleanHolder compress) + findConnection(java.util.List<EndpointI> endpoints, boolean tpc, Ice.BooleanHolder compress) { if(_destroyed) { @@ -478,20 +479,20 @@ public final class OutgoingConnectionFactory DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); assert(!endpoints.isEmpty()); - java.util.Iterator p = endpoints.iterator(); + java.util.Iterator<EndpointI> p = endpoints.iterator(); while(p.hasNext()) { - EndpointI endpoint = (EndpointI)p.next(); - java.util.LinkedList connectionList = (java.util.LinkedList)_connectionsByEndpoint.get(endpoint); + EndpointI endpoint = p.next(); + java.util.List<Ice.ConnectionI> connectionList = _connectionsByEndpoint.get(endpoint); if(connectionList == null) { continue; } - java.util.Iterator q = connectionList.iterator(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)q.next(); + Ice.ConnectionI connection = q.next(); if(connection.isActiveOrHolding() && connection.threadPerConnection() == tpc) // Don't return destroyed or un-validated connections { @@ -515,31 +516,31 @@ public final class OutgoingConnectionFactory // Must be called while synchronized. // private Ice.ConnectionI - findConnection(java.util.List connectors, Ice.BooleanHolder compress) + findConnection(java.util.List<ConnectorInfo> connectors, Ice.BooleanHolder compress) { DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides(); - java.util.Iterator p = connectors.iterator(); + java.util.Iterator<ConnectorInfo> p = connectors.iterator(); while(p.hasNext()) { - ConnectorInfo ci = (ConnectorInfo)p.next(); - java.util.LinkedList connectionList = (java.util.LinkedList)_connections.get(ci); + ConnectorInfo ci = p.next(); + java.util.List<Ice.ConnectionI> connectionList = _connections.get(ci); if(connectionList == null) { continue; } - java.util.Iterator q = connectionList.iterator(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); while(q.hasNext()) { - Ice.ConnectionI connection = (Ice.ConnectionI)q.next(); + Ice.ConnectionI connection = q.next(); if(connection.isActiveOrHolding()) // Don't return destroyed or un-validated connections { if(!connection.endpoint().equals(ci.endpoint)) { - java.util.List conList = (java.util.LinkedList)_connectionsByEndpoint.get(ci.endpoint); + java.util.List<Ice.ConnectionI> conList = _connectionsByEndpoint.get(ci.endpoint); if(conList == null) { - conList = new java.util.LinkedList(); + conList = new java.util.LinkedList<Ice.ConnectionI>(); _connectionsByEndpoint.put(ci.endpoint, conList); } conList.add(connection); @@ -591,7 +592,7 @@ public final class OutgoingConnectionFactory } private Ice.ConnectionI - getConnection(java.util.List connectors, ConnectCallback cb, Ice.BooleanHolder compress) + getConnection(java.util.List<ConnectorInfo> connectors, ConnectCallback cb, Ice.BooleanHolder compress) { synchronized(this) { @@ -603,46 +604,50 @@ public final class OutgoingConnectionFactory // // Reap connections for which destruction has completed. // - java.util.Iterator p = _connections.values().iterator(); - while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); - java.util.Iterator q = connectionList.iterator(); - while(q.hasNext()) + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connections.values().iterator(); + while(p.hasNext()) { - Ice.ConnectionI con = (Ice.ConnectionI)q.next(); - if(con.isFinished()) + java.util.List<Ice.ConnectionI> connectionList = p.next(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); + while(q.hasNext()) { - q.remove(); + Ice.ConnectionI con = q.next(); + if(con.isFinished()) + { + q.remove(); + } + } + + if(connectionList.isEmpty()) + { + p.remove(); } - } - - if(connectionList.isEmpty()) - { - p.remove(); } } - p = _connectionsByEndpoint.values().iterator(); - while(p.hasNext()) { - java.util.LinkedList connectionList = (java.util.LinkedList)p.next(); - java.util.Iterator q = connectionList.iterator(); - while(q.hasNext()) + java.util.Iterator<java.util.List<Ice.ConnectionI> > p = _connectionsByEndpoint.values().iterator(); + while(p.hasNext()) { - Ice.ConnectionI con = (Ice.ConnectionI)q.next(); - if(con.isFinished()) + java.util.List<Ice.ConnectionI> connectionList = p.next(); + java.util.Iterator<Ice.ConnectionI> q = connectionList.iterator(); + while(q.hasNext()) { - q.remove(); + Ice.ConnectionI con = q.next(); + if(con.isFinished()) + { + q.remove(); + } + } + + if(connectionList.isEmpty()) + { + p.remove(); } - } - - if(connectionList.isEmpty()) - { - p.remove(); } } - + // // Try to get the connection. We may need to wait for other threads to // finish if one of them is currently establishing a connection to one @@ -664,10 +669,10 @@ public final class OutgoingConnectionFactory // connectors since we just found a connection and therefore don't need to // wait anymore for other pending connectors. // - p = connectors.iterator(); + java.util.Iterator<ConnectorInfo> p = connectors.iterator(); while(p.hasNext()) { - java.util.Set cbs = (java.util.Set)_pending.get(p.next()); + java.util.Set<ConnectCallback> cbs = _pending.get(p.next()); if(cbs != null) { cbs.remove(cb); @@ -681,11 +686,11 @@ public final class OutgoingConnectionFactory // Determine whether another thread is currently attempting to connect to one of our endpoints; // if so we wait until it's done. // - p = connectors.iterator(); + java.util.Iterator<ConnectorInfo> p = connectors.iterator(); boolean found = false; while(p.hasNext()) { - java.util.Set cbs = (java.util.Set)_pending.get(p.next()); + java.util.Set<ConnectCallback> cbs = _pending.get(p.next()); if(cbs != null) { found = true; @@ -740,13 +745,13 @@ public final class OutgoingConnectionFactory // the _pending set to indicate that we're attempting connection establishment to // these connectors. We might attempt to connect to the same connector multiple times. // - p = connectors.iterator(); + java.util.Iterator<ConnectorInfo> p = connectors.iterator(); while(p.hasNext()) { - Object obj = p.next(); + ConnectorInfo obj = p.next(); if(!_pending.containsKey(obj)) { - _pending.put(obj, new java.util.HashSet()); + _pending.put(obj, new java.util.HashSet<ConnectCallback>()); } } } @@ -785,17 +790,17 @@ public final class OutgoingConnectionFactory Ice.ConnectionI connection = new Ice.ConnectionI(_instance, transceiver, ci.endpoint.compress(false), null, ci.threadPerConnection); - java.util.LinkedList connectionList = (java.util.LinkedList)_connections.get(ci); + java.util.List<Ice.ConnectionI> connectionList = _connections.get(ci); if(connectionList == null) { - connectionList = new java.util.LinkedList(); + connectionList = new java.util.LinkedList<Ice.ConnectionI>(); _connections.put(ci, connectionList); } connectionList.add(connection); - connectionList = (java.util.LinkedList)_connectionsByEndpoint.get(ci.endpoint); + connectionList = _connectionsByEndpoint.get(ci.endpoint); if(connectionList == null) { - connectionList = new java.util.LinkedList(); + connectionList = new java.util.LinkedList<Ice.ConnectionI>(); _connectionsByEndpoint.put(ci.endpoint, connectionList); } connectionList.add(connection); @@ -816,9 +821,9 @@ public final class OutgoingConnectionFactory } private void - finishGetConnection(java.util.List connectors, ConnectCallback cb, Ice.ConnectionI connection) + finishGetConnection(java.util.List<ConnectorInfo> connectors, ConnectCallback cb, Ice.ConnectionI connection) { - java.util.Set callbacks = new java.util.HashSet(); + java.util.Set<ConnectCallback> callbacks = new java.util.HashSet<ConnectCallback>(); synchronized(this) { @@ -828,10 +833,10 @@ public final class OutgoingConnectionFactory // notify the pending connect callbacks (outside the synchronization). // - java.util.Iterator p = connectors.iterator(); + java.util.Iterator<ConnectorInfo> p = connectors.iterator(); while(p.hasNext()) { - java.util.Set cbs = (java.util.Set)_pending.remove(p.next()); + java.util.Set<ConnectCallback> cbs = _pending.remove(p.next()); if(cbs != null) { callbacks.addAll(cbs); @@ -852,10 +857,10 @@ public final class OutgoingConnectionFactory // // Notify any waiting callbacks. // - java.util.Iterator p = callbacks.iterator(); + java.util.Iterator<ConnectCallback> p = callbacks.iterator(); while(p.hasNext()) { - ((ConnectCallback)p.next()).getConnection(); + p.next().getConnection(); } } @@ -899,7 +904,7 @@ public final class OutgoingConnectionFactory // synchronized(this) { - java.util.LinkedList connectionList = (java.util.LinkedList)_connections.get(ci); + java.util.List<Ice.ConnectionI> connectionList = _connections.get(ci); if(connectionList != null) // It might have already been reaped! { connectionList.remove(connection); @@ -909,7 +914,7 @@ public final class OutgoingConnectionFactory } } - connectionList = (java.util.LinkedList)_connectionsByEndpoint.get(ci.endpoint); + connectionList = _connectionsByEndpoint.get(ci.endpoint); if(connectionList != null) // It might have already been reaped! { connectionList.remove(connection); @@ -983,7 +988,7 @@ public final class OutgoingConnectionFactory private static class ConnectCallback implements Ice.ConnectionI.StartCallback, EndpointI_connectors { - ConnectCallback(OutgoingConnectionFactory f, java.util.List endpoints, boolean more, + ConnectCallback(OutgoingConnectionFactory f, java.util.List<EndpointI> endpoints, boolean more, CreateConnectionCallback cb, Ice.EndpointSelectionType selType, boolean threadPerConnection) { _factory = f; @@ -1045,7 +1050,7 @@ public final class OutgoingConnectionFactory // Methods from EndpointI_connectors // public void - connectors(java.util.List cons) + connectors(java.util.List<Connector> cons) { // // Shuffle connectors if endpoint selection type is Random. @@ -1055,10 +1060,10 @@ public final class OutgoingConnectionFactory java.util.Collections.shuffle(cons); } - java.util.Iterator q = cons.iterator(); + java.util.Iterator<Connector> q = cons.iterator(); while(q.hasNext()) { - _connectors.add(new ConnectorInfo((Connector)q.next(), _currentEndpoint, _threadPerConnection)); + _connectors.add(new ConnectorInfo(q.next(), _currentEndpoint, _threadPerConnection)); } if(_endpointsIter.hasNext()) @@ -1129,7 +1134,7 @@ public final class OutgoingConnectionFactory try { assert(_endpointsIter.hasNext()); - _currentEndpoint = (EndpointI)_endpointsIter.next(); + _currentEndpoint = _endpointsIter.next(); _currentEndpoint.connectors_async(this); } catch(Ice.LocalException ex) @@ -1177,7 +1182,7 @@ public final class OutgoingConnectionFactory try { assert(_iter.hasNext()); - _current = (ConnectorInfo)_iter.next(); + _current = _iter.next(); connection = _factory.createConnection(_current.connector.connect(0), _current); connection.start(this); } @@ -1190,21 +1195,24 @@ public final class OutgoingConnectionFactory private final OutgoingConnectionFactory _factory; private final boolean _hasMore; private final CreateConnectionCallback _callback; - private final java.util.List _endpoints; + private final java.util.List<EndpointI> _endpoints; private final Ice.EndpointSelectionType _selType; private final boolean _threadPerConnection; - private java.util.Iterator _endpointsIter; + private java.util.Iterator<EndpointI> _endpointsIter; private EndpointI _currentEndpoint; - private java.util.List _connectors = new java.util.ArrayList(); - private java.util.Iterator _iter; + private java.util.List<ConnectorInfo> _connectors = new java.util.ArrayList<ConnectorInfo>(); + private java.util.Iterator<ConnectorInfo> _iter; private ConnectorInfo _current; } private final Instance _instance; private boolean _destroyed; - private java.util.HashMap _connections = new java.util.HashMap(); - private java.util.HashMap _connectionsByEndpoint = new java.util.HashMap(); - private java.util.HashMap _pending = new java.util.HashMap(); + private java.util.Map<ConnectorInfo, java.util.List<Ice.ConnectionI> > _connections = + new java.util.HashMap<ConnectorInfo, java.util.List<Ice.ConnectionI> >(); + private java.util.Map<EndpointI, java.util.List<Ice.ConnectionI> > _connectionsByEndpoint = + new java.util.HashMap<EndpointI, java.util.List<Ice.ConnectionI> >(); + private java.util.Map<ConnectorInfo, java.util.HashSet<ConnectCallback> > _pending = + new java.util.HashMap<ConnectorInfo, java.util.HashSet<ConnectCallback> >(); private int _pendingConnectCount = 0; } diff --git a/java/src/IceInternal/PropertiesAdminI.java b/java/src/IceInternal/PropertiesAdminI.java index 950cf6e54f7..094c9eaf6ee 100644 --- a/java/src/IceInternal/PropertiesAdminI.java +++ b/java/src/IceInternal/PropertiesAdminI.java @@ -22,10 +22,10 @@ class PropertiesAdminI extends Ice._PropertiesAdminDisp return _properties.getProperty(name); } - public java.util.TreeMap + public java.util.TreeMap<String, String> getPropertiesForPrefix(String name, Ice.Current current) { - return new java.util.TreeMap(_properties.getPropertiesForPrefix(name)); + return new java.util.TreeMap<String, String>(_properties.getPropertiesForPrefix(name)); } private final Ice.Properties _properties; diff --git a/java/src/IceInternal/Reference.java b/java/src/IceInternal/Reference.java index 12723c2fd55..26253b67daf 100644 --- a/java/src/IceInternal/Reference.java +++ b/java/src/IceInternal/Reference.java @@ -54,7 +54,7 @@ public abstract class Reference implements Cloneable return _instance; } - public final java.util.Map + public final java.util.Map<String, String> getContext() { return _context; @@ -92,7 +92,7 @@ public abstract class Reference implements Cloneable // corresponding value changed. // public final Reference - changeContext(java.util.Map newContext) + changeContext(java.util.Map<String, String> newContext) { if(newContext == null) { @@ -105,7 +105,7 @@ public abstract class Reference implements Cloneable } else { - r._context = new java.util.HashMap(newContext); + r._context = new java.util.HashMap<String, String>(newContext); } return r; } @@ -423,7 +423,7 @@ public abstract class Reference implements Cloneable protected int _hashValue; protected boolean _hashInitialized; - private static java.util.HashMap _emptyContext = new java.util.HashMap(); + private static java.util.Map<String, String> _emptyContext = new java.util.HashMap<String, String>(); final private Instance _instance; final private Ice.Communicator _communicator; @@ -431,7 +431,7 @@ public abstract class Reference implements Cloneable private int _mode; private boolean _secure; private Ice.Identity _identity; - private java.util.Map _context; + private java.util.Map<String, String> _context; private String _facet; protected boolean _overrideCompress; protected boolean _compress; // Only used if _overrideCompress == true @@ -440,7 +440,7 @@ public abstract class Reference implements Cloneable Reference(Instance instance, Ice.Communicator communicator, Ice.Identity identity, - java.util.Map context, + java.util.Map<String, String> context, String facet, int mode, boolean secure) diff --git a/java/src/IceInternal/ReferenceFactory.java b/java/src/IceInternal/ReferenceFactory.java index 958f82e34a8..2e5ed274c90 100644 --- a/java/src/IceInternal/ReferenceFactory.java +++ b/java/src/IceInternal/ReferenceFactory.java @@ -345,11 +345,11 @@ public final class ReferenceFactory return create(ident, facet, mode, secure, null, null, propertyPrefix); } - java.util.ArrayList endpoints = new java.util.ArrayList(); + java.util.ArrayList<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); if(s.charAt(beg) == ':') { - java.util.ArrayList unknownEndpoints = new java.util.ArrayList(); + java.util.ArrayList<String> unknownEndpoints = new java.util.ArrayList<String>(); end = beg; while(end < s.length() && s.charAt(end) == ':') @@ -413,17 +413,17 @@ public final class ReferenceFactory if(endpoints.size() == 0) { Ice.EndpointParseException e = new Ice.EndpointParseException(); - e.str = (String)unknownEndpoints.get(0); + e.str = unknownEndpoints.get(0); throw e; } else if(unknownEndpoints.size() != 0 && _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0) { String msg = "Proxy contains unknown endpoints:"; - java.util.Iterator iter = unknownEndpoints.iterator(); + java.util.Iterator<String> iter = unknownEndpoints.iterator(); while(iter.hasNext()) { - msg += " `" + (String)iter.next() + "'"; + msg += " `" + iter.next() + "'"; } _instance.initializationData().logger.warning(msg); } @@ -618,22 +618,22 @@ public final class ReferenceFactory // WeakHashMap class internally creates a weak reference for the // key, and we use a weak reference for the value as well. // - java.lang.ref.WeakReference w = (java.lang.ref.WeakReference)_references.get(ref); + java.lang.ref.WeakReference<Reference> w = _references.get(ref); if(w != null) { - Reference r = (Reference)w.get(); + Reference r = w.get(); if(r != null) { ref = r; } else { - _references.put(ref, new java.lang.ref.WeakReference(ref)); + _references.put(ref, new java.lang.ref.WeakReference<Reference>(ref)); } } else { - _references.put(ref, new java.lang.ref.WeakReference(ref)); + _references.put(ref, new java.lang.ref.WeakReference<Reference>(ref)); } return ref; @@ -665,13 +665,14 @@ public final class ReferenceFactory } } - java.util.ArrayList unknownProps = new java.util.ArrayList(); - java.util.Map props = _instance.initializationData().properties.getPropertiesForPrefix(prefix + "."); - java.util.Iterator p = props.entrySet().iterator(); + java.util.ArrayList<String> unknownProps = new java.util.ArrayList<String>(); + java.util.Map<String, String> props = + _instance.initializationData().properties.getPropertiesForPrefix(prefix + "."); + java.util.Iterator<java.util.Map.Entry<String, String> > p = props.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - String prop = (String)entry.getKey(); + java.util.Map.Entry<String, String> entry = p.next(); + String prop = entry.getKey(); boolean valid = false; for(int i = 0; i < _suffixes.length; ++i) @@ -692,10 +693,10 @@ public final class ReferenceFactory if(unknownProps.size() != 0) { String message = "found unknown properties for proxy '" + prefix + "':"; - p = unknownProps.iterator(); - while(p.hasNext()) + java.util.Iterator<String> q = unknownProps.iterator(); + while(q.hasNext()) { - message += "\n " + (String)p.next(); + message += "\n " + q.next(); } _instance.initializationData().logger.warning(message); } @@ -819,5 +820,6 @@ public final class ReferenceFactory final private Ice.Communicator _communicator; private Ice.RouterPrx _defaultRouter; private Ice.LocatorPrx _defaultLocator; - private java.util.WeakHashMap _references = new java.util.WeakHashMap(); + private java.util.WeakHashMap<Reference, java.lang.ref.WeakReference<Reference> > _references = + new java.util.WeakHashMap<Reference, java.lang.ref.WeakReference<Reference> >(); } diff --git a/java/src/IceInternal/RequestHandler.java b/java/src/IceInternal/RequestHandler.java index 61ca7daede6..2daa83c2325 100644 --- a/java/src/IceInternal/RequestHandler.java +++ b/java/src/IceInternal/RequestHandler.java @@ -28,7 +28,7 @@ public interface RequestHandler Ice.ConnectionI getConnection(boolean wait); - Outgoing getOutgoing(String operation, Ice.OperationMode mode, java.util.Map context) + Outgoing getOutgoing(String operation, Ice.OperationMode mode, java.util.Map<String, String> context) throws LocalExceptionWrapper; void reclaimOutgoing(Outgoing out); diff --git a/java/src/IceInternal/RoutableReference.java b/java/src/IceInternal/RoutableReference.java index 996611d0dd4..6bf1640750e 100644 --- a/java/src/IceInternal/RoutableReference.java +++ b/java/src/IceInternal/RoutableReference.java @@ -609,7 +609,7 @@ public class RoutableReference extends Reference RoutableReference(Instance instance, Ice.Communicator communicator, Ice.Identity identity, - java.util.Map context, + java.util.Map<String, String> context, String facet, int mode, boolean secure, @@ -672,7 +672,7 @@ public class RoutableReference extends Reference private EndpointI[] filterEndpoints(EndpointI[] allEndpoints) { - java.util.ArrayList endpoints = new java.util.ArrayList(); + java.util.List<EndpointI> endpoints = new java.util.ArrayList<EndpointI>(); // // Filter out unknown endpoints. @@ -697,10 +697,10 @@ public class RoutableReference extends Reference // // Filter out datagram endpoints. // - java.util.Iterator i = endpoints.iterator(); + java.util.Iterator<EndpointI> i = endpoints.iterator(); while(i.hasNext()) { - EndpointI endpoint = (EndpointI)i.next(); + EndpointI endpoint = i.next(); if(endpoint.datagram()) { i.remove(); @@ -715,10 +715,10 @@ public class RoutableReference extends Reference // // Filter out non-datagram endpoints. // - java.util.Iterator i = endpoints.iterator(); + java.util.Iterator<EndpointI> i = endpoints.iterator(); while(i.hasNext()) { - EndpointI endpoint = (EndpointI)i.next(); + EndpointI endpoint = i.next(); if(!endpoint.datagram()) { i.remove(); @@ -759,10 +759,10 @@ public class RoutableReference extends Reference DefaultsAndOverrides overrides = getInstance().defaultsAndOverrides(); if(overrides.overrideSecure ? overrides.overrideSecureValue : getSecure()) { - java.util.Iterator i = endpoints.iterator(); + java.util.Iterator<EndpointI> i = endpoints.iterator(); while(i.hasNext()) { - EndpointI endpoint = (EndpointI)i.next(); + EndpointI endpoint = i.next(); if(!endpoint.secure()) { i.remove(); @@ -951,7 +951,7 @@ public class RoutableReference extends Reference } } - static class EndpointComparator implements java.util.Comparator + static class EndpointComparator implements java.util.Comparator<EndpointI> { EndpointComparator(boolean preferSecure) { @@ -959,10 +959,8 @@ public class RoutableReference extends Reference } public int - compare(java.lang.Object l, java.lang.Object r) + compare(EndpointI le, EndpointI re) { - IceInternal.EndpointI le = (IceInternal.EndpointI)l; - IceInternal.EndpointI re = (IceInternal.EndpointI)r; boolean ls = le.secure(); boolean rs = re.secure(); if((ls && rs) || (!ls && !rs)) diff --git a/java/src/IceInternal/RouterInfo.java b/java/src/IceInternal/RouterInfo.java index 0029a4d45f3..b266d65b1c0 100644 --- a/java/src/IceInternal/RouterInfo.java +++ b/java/src/IceInternal/RouterInfo.java @@ -281,6 +281,6 @@ public final class RouterInfo private EndpointI[] _clientEndpoints; private EndpointI[] _serverEndpoints; private Ice.ObjectAdapter _adapter; - private java.util.HashSet _identities = new java.util.HashSet(); - private java.util.List _evictedIdentities = new java.util.ArrayList(); + private java.util.Set<Ice.Identity> _identities = new java.util.HashSet<Ice.Identity>(); + private java.util.List<Ice.Identity> _evictedIdentities = new java.util.ArrayList<Ice.Identity>(); } diff --git a/java/src/IceInternal/RouterManager.java b/java/src/IceInternal/RouterManager.java index b853684ff55..05e25147c2e 100644 --- a/java/src/IceInternal/RouterManager.java +++ b/java/src/IceInternal/RouterManager.java @@ -18,10 +18,10 @@ public final class RouterManager synchronized void destroy() { - java.util.Iterator i = _table.values().iterator(); + java.util.Iterator<RouterInfo> i = _table.values().iterator(); while(i.hasNext()) { - RouterInfo info = (RouterInfo)i.next(); + RouterInfo info = i.next(); info.destroy(); } _table.clear(); @@ -46,7 +46,7 @@ public final class RouterManager synchronized(this) { - RouterInfo info = (RouterInfo)_table.get(router); + RouterInfo info = _table.get(router); if(info == null) { info = new RouterInfo(router); @@ -68,11 +68,11 @@ public final class RouterManager synchronized(this) { - info = (RouterInfo)_table.remove(router); + info = _table.remove(router); } } return info; } - private java.util.HashMap _table = new java.util.HashMap(); + private java.util.HashMap<Ice.RouterPrx, RouterInfo> _table = new java.util.HashMap<Ice.RouterPrx, RouterInfo>(); } diff --git a/java/src/IceInternal/SelectorThread.java b/java/src/IceInternal/SelectorThread.java index c0e93d24b87..f3a824bfdc0 100644 --- a/java/src/IceInternal/SelectorThread.java +++ b/java/src/IceInternal/SelectorThread.java @@ -168,9 +168,10 @@ public class SelectorThread public void run() { - java.util.HashMap socketMap = new java.util.HashMap(); - java.util.LinkedList readyList = new java.util.LinkedList(); - java.util.LinkedList finishedList = new java.util.LinkedList(); + java.util.Map<java.nio.channels.SelectableChannel, SocketInfo> socketMap = + new java.util.HashMap<java.nio.channels.SelectableChannel, SocketInfo>(); + java.util.LinkedList<SocketInfo> readyList = new java.util.LinkedList<SocketInfo>(); + java.util.LinkedList<SocketInfo> finishedList = new java.util.LinkedList<SocketInfo>(); while(true) { int ret = 0; @@ -236,7 +237,7 @@ public class SelectorThread _keys.remove(_fdIntrReadKey); clearInterrupt(); - SocketInfo info = (SocketInfo)_changes.removeFirst(); + SocketInfo info = _changes.removeFirst(); if(info.cb != null) // Registration { try @@ -252,7 +253,7 @@ public class SelectorThread } else // Unregistration { - info = (SocketInfo)socketMap.get(info.fd); + info = socketMap.get(info.fd); if(info != null && info.status != SocketStatus.Finished) { if(info.timeout >= 0) @@ -279,13 +280,13 @@ public class SelectorThread // // Examine the selection key set. // - java.util.Iterator iter = _keys.iterator(); + java.util.Iterator<java.nio.channels.SelectionKey> iter = _keys.iterator(); while(iter.hasNext()) { // // Ignore selection keys that have been cancelled or timed out. // - java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)iter.next(); + java.nio.channels.SelectionKey key = iter.next(); iter.remove(); assert(key != _fdIntrReadKey); SocketInfo info = (SocketInfo)key.attachment(); @@ -298,10 +299,10 @@ public class SelectorThread } } - java.util.Iterator iter = readyList.iterator(); + java.util.Iterator<SocketInfo> iter = readyList.iterator(); while(iter.hasNext()) { - SocketInfo info = (SocketInfo)iter.next(); + SocketInfo info = iter.next(); SocketStatus status; try { @@ -318,7 +319,7 @@ public class SelectorThread _instance.initializationData().logger.error(s); status = SocketStatus.Finished; } - + if(status == SocketStatus.Finished) { finishedList.add(info); @@ -351,7 +352,7 @@ public class SelectorThread iter = finishedList.iterator(); while(iter.hasNext()) { - SocketInfo info = (SocketInfo)iter.next(); + SocketInfo info = iter.next(); if(info.status != SocketStatus.Finished) { try @@ -430,8 +431,8 @@ public class SelectorThread private java.nio.channels.SelectionKey _fdIntrReadKey; private java.nio.channels.WritableByteChannel _fdIntrWrite; private java.nio.channels.Selector _selector; - private java.util.Set _keys; - private java.util.LinkedList _changes = new java.util.LinkedList(); + private java.util.Set<java.nio.channels.SelectionKey> _keys; + private java.util.LinkedList<SocketInfo> _changes = new java.util.LinkedList<SocketInfo>(); private final class SocketInfo implements TimerTask { diff --git a/java/src/IceInternal/ServantManager.java b/java/src/IceInternal/ServantManager.java index 61ce81b58b2..8e4dcc1374a 100644 --- a/java/src/IceInternal/ServantManager.java +++ b/java/src/IceInternal/ServantManager.java @@ -21,10 +21,10 @@ public final class ServantManager facet = ""; } - java.util.HashMap m = (java.util.HashMap)_servantMapMap.get(ident); + java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); if(m == null) { - m = new java.util.HashMap(); + m = new java.util.HashMap<String, Ice.Object>(); _servantMapMap.put(ident, m); } else @@ -55,9 +55,9 @@ public final class ServantManager facet = ""; } - java.util.HashMap m = (java.util.HashMap)_servantMapMap.get(ident); + java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); Ice.Object obj = null; - if(m == null || (obj = (Ice.Object)m.remove(facet)) == null) + if(m == null || (obj = m.remove(facet)) == null) { Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); ex.id = _instance.identityToString(ident); @@ -76,12 +76,12 @@ public final class ServantManager return obj; } - public synchronized java.util.Map + public synchronized java.util.Map<String, Ice.Object> removeAllFacets(Ice.Identity ident) { assert(_instance != null); // Must not be called after destruction. - java.util.HashMap m = (java.util.HashMap)_servantMapMap.get(ident); + java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); if(m == null) { Ice.NotRegisteredException ex = new Ice.NotRegisteredException(); @@ -111,28 +111,28 @@ public final class ServantManager facet = ""; } - java.util.HashMap m = (java.util.HashMap)_servantMapMap.get(ident); + java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); Ice.Object obj = null; if(m != null) { - obj = (Ice.Object)m.get(facet); + obj = m.get(facet); } return obj; } - public synchronized java.util.Map + public synchronized java.util.Map<String, Ice.Object> findAllFacets(Ice.Identity ident) { assert(_instance != null); // Must not be called after destruction. - java.util.HashMap m = (java.util.HashMap)_servantMapMap.get(ident); + java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); if(m != null) { - return new java.util.HashMap(m); + return new java.util.HashMap<String, Ice.Object>(m); } - return new java.util.HashMap(); + return new java.util.HashMap<String, Ice.Object>(); } public synchronized boolean @@ -146,7 +146,7 @@ public final class ServantManager // //assert(_instance != null); // Must not be called after destruction. - java.util.HashMap m = (java.util.HashMap)_servantMapMap.get(ident); + java.util.Map<String, Ice.Object> m = _servantMapMap.get(ident); if(m == null) { return false; @@ -163,7 +163,7 @@ public final class ServantManager { assert(_instance != null); // Must not be called after destruction. - Ice.ServantLocator l = (Ice.ServantLocator)_locatorMap.get(category); + Ice.ServantLocator l = _locatorMap.get(category); if(l != null) { Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); @@ -186,7 +186,7 @@ public final class ServantManager // //assert(_instance != null); // Must not be called after destruction. - return (Ice.ServantLocator)_locatorMap.get(category); + return _locatorMap.get(category); } // @@ -223,14 +223,14 @@ public final class ServantManager _servantMapMap.clear(); - java.util.Iterator p = _locatorMap.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, Ice.ServantLocator> > p = _locatorMap.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry e = (java.util.Map.Entry)p.next(); - Ice.ServantLocator locator = (Ice.ServantLocator)e.getValue(); + java.util.Map.Entry<String, Ice.ServantLocator> e = p.next(); + Ice.ServantLocator locator = e.getValue(); try { - locator.deactivate((String)e.getKey()); + locator.deactivate(e.getKey()); } catch(java.lang.Exception ex) { @@ -251,6 +251,7 @@ public final class ServantManager private Instance _instance; final private String _adapterName; - private java.util.HashMap _servantMapMap = new java.util.HashMap(); - private java.util.HashMap _locatorMap = new java.util.HashMap(); + private java.util.Map<Ice.Identity, java.util.Map<String, Ice.Object> > _servantMapMap = + new java.util.HashMap<Ice.Identity, java.util.Map<String, Ice.Object> >(); + private java.util.Map<String, Ice.ServantLocator> _locatorMap = new java.util.HashMap<String, Ice.ServantLocator>(); } diff --git a/java/src/IceInternal/TcpEndpointI.java b/java/src/IceInternal/TcpEndpointI.java index 0bb27127ad7..c0cc50c8388 100644 --- a/java/src/IceInternal/TcpEndpointI.java +++ b/java/src/IceInternal/TcpEndpointI.java @@ -356,7 +356,7 @@ final class TcpEndpointI extends EndpointI // Return connectors for this endpoint, or empty list if no connector // is available. // - public java.util.List + public java.util.List<Connector> connectors() { return connectors(Network.getAddresses(_host, _port, _instance.protocolSupport())); @@ -388,21 +388,21 @@ final class TcpEndpointI extends EndpointI // Expand endpoint out in to separate endpoints for each local // host if listening on INADDR_ANY. // - public java.util.List + public java.util.List<EndpointI> expand() { - java.util.ArrayList endps = new java.util.ArrayList(); - java.util.ArrayList hosts = Network.getHostsForEndpointExpand(_host, _instance.protocolSupport()); + java.util.List<EndpointI> endps = new java.util.ArrayList<EndpointI>(); + java.util.List<String> hosts = Network.getHostsForEndpointExpand(_host, _instance.protocolSupport()); if(hosts == null || hosts.isEmpty()) { endps.add(this); } else { - java.util.Iterator p = hosts.iterator(); + java.util.Iterator<String> p = hosts.iterator(); while(p.hasNext()) { - endps.add(new TcpEndpointI(_instance, (String)p.next(), _port, _timeout, _connectionId, _compress)); + endps.add(new TcpEndpointI(_instance, p.next(), _port, _timeout, _connectionId, _compress)); } } return endps; @@ -438,11 +438,19 @@ final class TcpEndpointI extends EndpointI public boolean equals(java.lang.Object obj) { - return compareTo(obj) == 0; + try + { + return compareTo((EndpointI)obj) == 0; + } + catch(ClassCastException ee) + { + assert(false); + return false; + } } public int - compareTo(java.lang.Object obj) // From java.lang.Comparable + compareTo(EndpointI obj) // From java.lang.Comparable { TcpEndpointI p = null; @@ -452,15 +460,7 @@ final class TcpEndpointI extends EndpointI } catch(ClassCastException ex) { - try - { - EndpointI e = (EndpointI)obj; - return type() < e.type() ? -1 : 1; - } - catch(ClassCastException ee) - { - assert(false); - } + return type() < obj.type() ? -1 : 1; } if(this == p) @@ -503,14 +503,14 @@ final class TcpEndpointI extends EndpointI return _host.compareTo(p._host); } - public java.util.List - connectors(java.util.List addresses) + public java.util.List<Connector> + connectors(java.util.List<java.net.InetSocketAddress> addresses) { - java.util.ArrayList connectors = new java.util.ArrayList(); - java.util.Iterator p = addresses.iterator(); + java.util.List<Connector> connectors = new java.util.ArrayList<Connector>(); + java.util.Iterator<java.net.InetSocketAddress> p = addresses.iterator(); while(p.hasNext()) { - connectors.add(new TcpConnector(_instance, (java.net.InetSocketAddress)p.next(), _timeout, _connectionId)); + connectors.add(new TcpConnector(_instance, p.next(), _timeout, _connectionId)); } return connectors; } diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java index 3a8173da69e..8c7a74cdc1d 100644 --- a/java/src/IceInternal/ThreadPool.java +++ b/java/src/IceInternal/ThreadPool.java @@ -103,7 +103,7 @@ public final class ThreadPool try { - _threads = new java.util.ArrayList(); + _threads = new java.util.ArrayList<EventHandlerThread>(); for(int i = 0; i < _size; i++) { EventHandlerThread thread = new EventHandlerThread(_programNamePrefix + _prefix + "-" + @@ -261,10 +261,10 @@ public final class ThreadPool // wouldn't be possible here anyway, because otherwise the // other threads would never terminate.) // - java.util.Iterator i = _threads.iterator(); + java.util.Iterator<EventHandlerThread> i = _threads.iterator(); while(i.hasNext()) { - EventHandlerThread thread = (EventHandlerThread)i.next(); + EventHandlerThread thread = i.next(); while(true) { @@ -467,12 +467,12 @@ public final class ThreadPool { if(TRACE_REGISTRATION) { - java.util.Set keys = _selector.keys(); + java.util.Set<java.nio.channels.SelectionKey> keys = _selector.keys(); trace("selecting on " + keys.size() + " channels:"); - java.util.Iterator i = keys.iterator(); + java.util.Iterator<java.nio.channels.SelectionKey> i = keys.iterator(); while(i.hasNext()) { - java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)i.next(); + java.nio.channels.SelectionKey key = i.next(); trace(" " + key.channel()); } } @@ -486,7 +486,7 @@ public final class ThreadPool // if(!_pendingHandlers.isEmpty()) { - handler = (EventHandler)_pendingHandlers.removeFirst(); + handler = _pendingHandlers.removeFirst(); } else { @@ -542,7 +542,7 @@ public final class ThreadPool _keys.remove(_fdIntrReadKey); clearInterrupt(); assert(!_workItems.isEmpty()); - workItem = (ThreadPoolWorkItem)_workItems.removeFirst(); + workItem = _workItems.removeFirst(); } else if(_destroyed) { @@ -568,7 +568,7 @@ public final class ThreadPool // An event handler must have been registered or unregistered. // assert(!_changes.isEmpty()); - FdHandlerPair change = (FdHandlerPair)_changes.removeFirst(); + FdHandlerPair change = _changes.removeFirst(); if(change.handler != null) // Addition if handler is set. { @@ -615,7 +615,7 @@ public final class ThreadPool } else // Removal if handler is not set. { - HandlerKeyPair pair = (HandlerKeyPair)_handlerMap.remove(change.fd); + HandlerKeyPair pair = _handlerMap.remove(change.fd); assert(pair != null); handler = pair.handler; finished = true; @@ -639,13 +639,13 @@ public final class ThreadPool else { java.nio.channels.SelectionKey key = null; - java.util.Iterator iter = _keys.iterator(); + java.util.Iterator<java.nio.channels.SelectionKey> iter = _keys.iterator(); while(iter.hasNext()) { // // Ignore selection keys that have been cancelled // - java.nio.channels.SelectionKey k = (java.nio.channels.SelectionKey)iter.next(); + java.nio.channels.SelectionKey k = iter.next(); iter.remove(); if(k.isValid() && k != _fdIntrReadKey) { @@ -885,10 +885,10 @@ public final class ThreadPool assert(_running <= sz); if(_running < sz) { - java.util.Iterator i = _threads.iterator(); + java.util.Iterator<EventHandlerThread> i = _threads.iterator(); while(i.hasNext()) { - EventHandlerThread thread = (EventHandlerThread)i.next(); + EventHandlerThread thread = i.next(); if(!thread.isAlive()) { @@ -1108,10 +1108,10 @@ public final class ThreadPool if(_keys.size() > 0) { trace("after selectNow, there are " + _keys.size() + " selected keys:"); - java.util.Iterator i = _keys.iterator(); + java.util.Iterator<java.nio.channels.SelectionKey> i = _keys.iterator(); while(i.hasNext()) { - java.nio.channels.SelectionKey key = (java.nio.channels.SelectionKey)i.next(); + java.nio.channels.SelectionKey key = i.next(); trace(" " + keyToString(key)); } } @@ -1271,12 +1271,13 @@ public final class ThreadPool private java.nio.channels.SelectionKey _fdIntrReadKey; private java.nio.channels.WritableByteChannel _fdIntrWrite; private java.nio.channels.Selector _selector; - private java.util.Set _keys; + private java.util.Set<java.nio.channels.SelectionKey> _keys; - private java.util.LinkedList _changes = new java.util.LinkedList(); - private java.util.LinkedList _workItems = new java.util.LinkedList(); + private java.util.LinkedList<FdHandlerPair> _changes = new java.util.LinkedList<FdHandlerPair>(); + private java.util.LinkedList<ThreadPoolWorkItem> _workItems = new java.util.LinkedList<ThreadPoolWorkItem>(); - private java.util.HashMap _handlerMap = new java.util.HashMap(); + private java.util.Map<java.nio.channels.SelectableChannel, HandlerKeyPair> _handlerMap = + new java.util.HashMap<java.nio.channels.SelectableChannel, HandlerKeyPair>(); private int _timeout; @@ -1286,7 +1287,7 @@ public final class ThreadPool // the thread pool to read more data before it re-enters a blocking call to // select(). // - private java.util.LinkedList _pendingHandlers = new java.util.LinkedList(); + private java.util.LinkedList<EventHandler> _pendingHandlers = new java.util.LinkedList<EventHandler>(); private final class EventHandlerThread extends Thread { @@ -1362,7 +1363,7 @@ public final class ThreadPool private final int _sizeMax; // Maximum number of threads. private final int _sizeWarn; // If _inUse reaches _sizeWarn, a "low on threads" warning will be printed. - private java.util.ArrayList _threads; // All threads, running or not. + private java.util.List<EventHandlerThread> _threads; // All threads, running or not. private int _threadIndex; // For assigning thread names. private int _running; // Number of running threads. private int _inUse; // Number of threads that are currently in use. diff --git a/java/src/IceInternal/Timer.java b/java/src/IceInternal/Timer.java index 02ebcd81267..319129232c4 100644 --- a/java/src/IceInternal/Timer.java +++ b/java/src/IceInternal/Timer.java @@ -20,7 +20,7 @@ public final class Timer extends Thread // Renamed from destroy to _destroy to avoid a deprecation warning caused // by the destroy method inherited from Thread. // - public void + public void _destroy() { synchronized(this) @@ -32,11 +32,11 @@ public final class Timer extends Thread _instance = null; notify(); - + _tokens.clear(); _tasks.clear(); } - + while(true) { try @@ -60,7 +60,7 @@ public final class Timer extends Thread final Token token = new Token(IceInternal.Time.currentMonotonicTimeMillis() + delay, ++_tokenId, 0, task); - Object previous = _tasks.put(task, token); + Token previous = _tasks.put(task, token); assert previous == null; _tokens.add(token); @@ -80,7 +80,7 @@ public final class Timer extends Thread final Token token = new Token(IceInternal.Time.currentMonotonicTimeMillis() + period, ++_tokenId, period, task); - Object previous = _tasks.put(task, token); + Token previous = _tasks.put(task, token); assert previous == null; _tokens.add(token); @@ -98,7 +98,7 @@ public final class Timer extends Thread return false; } - Token token = (Token)_tasks.remove(task); + Token token = _tasks.remove(task); if(token == null) { return false; @@ -130,7 +130,7 @@ public final class Timer extends Thread throws Throwable { IceUtilInternal.Assert.FinalizerAssert(_instance == null); - + super.finalize(); } @@ -179,16 +179,16 @@ public final class Timer extends Thread } } } - + if(_instance == null) { break; } - + while(!_tokens.isEmpty() && _instance != null) { long now = IceInternal.Time.currentMonotonicTimeMillis(); - Token first = (Token)_tokens.first(); + Token first = _tokens.first(); if(first.scheduledTime <= now) { _tokens.remove(first); @@ -199,7 +199,7 @@ public final class Timer extends Thread } break; } - + _wakeUpTime = first.scheduledTime; while(true) { @@ -213,7 +213,7 @@ public final class Timer extends Thread } } } - + if(_instance == null) { break; @@ -240,14 +240,14 @@ public final class Timer extends Thread _instance.initializationData().logger.error(s); } } - } + } } } } static private class Token implements Comparable { - public + public Token(long scheduledTime, int id, long delay, TimerTask task) { this.scheduledTime = scheduledTime; @@ -256,7 +256,7 @@ public final class Timer extends Thread this.task = task; } - public int + public int compareTo(Object o) { // @@ -280,7 +280,7 @@ public final class Timer extends Thread { return 1; } - + return 0; } @@ -290,8 +290,8 @@ public final class Timer extends Thread TimerTask task; } - private final java.util.SortedSet _tokens = new java.util.TreeSet(); - private final java.util.Map _tasks = new java.util.HashMap(); + private final java.util.SortedSet<Token> _tokens = new java.util.TreeSet<Token>(); + private final java.util.Map<TimerTask, Token> _tasks = new java.util.HashMap<TimerTask, Token>(); private Instance _instance; private long _wakeUpTime = Long.MAX_VALUE; private int _tokenId = 0; diff --git a/java/src/IceInternal/TraceUtil.java b/java/src/IceInternal/TraceUtil.java index 68c894fa482..a239bf044f4 100644 --- a/java/src/IceInternal/TraceUtil.java +++ b/java/src/IceInternal/TraceUtil.java @@ -62,7 +62,7 @@ public final class TraceUtil } } - private static java.util.Set slicingIds = new java.util.HashSet(); + private static java.util.Set<String> slicingIds = new java.util.HashSet<String>(); synchronized static void traceSlicing(String kind, String typeId, String slicingCat, Ice.Logger logger) diff --git a/java/src/IceInternal/UdpEndpointI.java b/java/src/IceInternal/UdpEndpointI.java index 3f5f76d390a..eba1981d803 100644 --- a/java/src/IceInternal/UdpEndpointI.java +++ b/java/src/IceInternal/UdpEndpointI.java @@ -522,7 +522,7 @@ final class UdpEndpointI extends EndpointI // Return connectors for this endpoint, or empty list if no connector // is available. // - public java.util.List + public java.util.List<Connector> connectors() { return connectors(Network.getAddresses(_host, _port, _instance.protocolSupport())); @@ -552,21 +552,21 @@ final class UdpEndpointI extends EndpointI // Expand endpoint out in to separate endpoints for each local // host if listening on INADDR_ANY. // - public java.util.List + public java.util.List<EndpointI> expand() { - java.util.ArrayList endps = new java.util.ArrayList(); - java.util.ArrayList hosts = Network.getHostsForEndpointExpand(_host, _instance.protocolSupport()); + java.util.ArrayList<EndpointI> endps = new java.util.ArrayList<EndpointI>(); + java.util.ArrayList<String> hosts = Network.getHostsForEndpointExpand(_host, _instance.protocolSupport()); if(hosts == null || hosts.isEmpty()) { endps.add(this); } else { - java.util.Iterator p = hosts.iterator(); + java.util.Iterator<String> p = hosts.iterator(); while(p.hasNext()) { - endps.add(new UdpEndpointI(_instance, (String)p.next(), _port, _mcastInterface, _mcastTtl, + endps.add(new UdpEndpointI(_instance, p.next(), _port, _mcastInterface, _mcastTtl, _protocolMajor, _protocolMinor, _encodingMajor, _encodingMinor, _connect, _connectionId, _compress)); } @@ -605,11 +605,19 @@ final class UdpEndpointI extends EndpointI public boolean equals(java.lang.Object obj) { - return compareTo(obj) == 0; + try + { + return compareTo((EndpointI)obj) == 0; + } + catch(ClassCastException ee) + { + assert(false); + return false; + } } public int - compareTo(java.lang.Object obj) // From java.lang.Comparable + compareTo(EndpointI obj) // From java.lang.Comparable { UdpEndpointI p = null; @@ -619,15 +627,7 @@ final class UdpEndpointI extends EndpointI } catch(ClassCastException ex) { - try - { - EndpointI e = (EndpointI)obj; - return type() < e.type() ? -1 : 1; - } - catch(ClassCastException ee) - { - assert(false); - } + return type() < obj.type() ? -1 : 1; } if(this == p) @@ -721,16 +721,16 @@ final class UdpEndpointI extends EndpointI return _host.compareTo(p._host); } - public java.util.List - connectors(java.util.List addresses) + public java.util.List<Connector> + connectors(java.util.List<java.net.InetSocketAddress> addresses) { - java.util.ArrayList connectors = new java.util.ArrayList(); - java.util.Iterator p = addresses.iterator(); + java.util.ArrayList<Connector> connectors = new java.util.ArrayList<Connector>(); + java.util.Iterator<java.net.InetSocketAddress> p = addresses.iterator(); while(p.hasNext()) { connectors.add( - new UdpConnector(_instance, (java.net.InetSocketAddress)p.next(), _mcastInterface, _mcastTtl, - _protocolMajor, _protocolMinor, _encodingMajor, _encodingMinor, _connectionId)); + new UdpConnector(_instance, p.next(), _mcastInterface, _mcastTtl, _protocolMajor, _protocolMinor, + _encodingMajor, _encodingMinor, _connectionId)); } return connectors; } diff --git a/java/src/IceInternal/UnknownEndpointI.java b/java/src/IceInternal/UnknownEndpointI.java index 231d040864d..6e940af8ed7 100644 --- a/java/src/IceInternal/UnknownEndpointI.java +++ b/java/src/IceInternal/UnknownEndpointI.java @@ -238,16 +238,16 @@ final class UnknownEndpointI extends EndpointI // Return connectors for this endpoint, or empty list if no connector // is available. // - public java.util.List + public java.util.List<Connector> connectors() { - return new java.util.ArrayList(); + return new java.util.ArrayList<Connector>(); } public void connectors_async(EndpointI_connectors callback) { - callback.connectors(new java.util.ArrayList()); + callback.connectors(new java.util.ArrayList<Connector>()); } // @@ -269,10 +269,10 @@ final class UnknownEndpointI extends EndpointI // host if listening on INADDR_ANY on server side or if no host // was specified on client side. // - public java.util.List + public java.util.List<EndpointI> expand() { - java.util.ArrayList endps = new java.util.ArrayList(); + java.util.List<EndpointI> endps = new java.util.ArrayList<EndpointI>(); endps.add(this); return endps; } @@ -298,11 +298,19 @@ final class UnknownEndpointI extends EndpointI public boolean equals(java.lang.Object obj) { - return compareTo(obj) == 0; + try + { + return compareTo((EndpointI)obj) == 0; + } + catch(ClassCastException ee) + { + assert(false); + return false; + } } public int - compareTo(java.lang.Object obj) // From java.lang.Comparable + compareTo(EndpointI obj) // From java.lang.Comparable { UnknownEndpointI p = null; diff --git a/java/src/IceInternal/ValueWriter.java b/java/src/IceInternal/ValueWriter.java index aab0b88c137..63efa63640a 100644 --- a/java/src/IceInternal/ValueWriter.java +++ b/java/src/IceInternal/ValueWriter.java @@ -18,7 +18,8 @@ public final class ValueWriter } private static void - writeValue(String name, java.lang.Object value, java.util.Map objectTable, IceUtilInternal.OutputBase out) + writeValue(String name, java.lang.Object value, java.util.Map<java.lang.Object, java.lang.Object> objectTable, + IceUtilInternal.OutputBase out) { if(value == null) { @@ -27,7 +28,7 @@ public final class ValueWriter } else { - Class c = value.getClass(); + Class<?> c = value.getClass(); if(c.equals(Byte.class) || c.equals(Short.class) || c.equals(Integer.class) || c.equals(Long.class) || c.equals(Double.class) || c.equals(Float.class) || c.equals(Boolean.class)) { @@ -99,7 +100,7 @@ public final class ValueWriter { if(objectTable == null) { - objectTable = new java.util.IdentityHashMap(); + objectTable = new java.util.IdentityHashMap<java.lang.Object, java.lang.Object>(); } objectTable.put(value, null); writeFields(name, value, c, objectTable, out); @@ -178,7 +179,8 @@ public final class ValueWriter } private static void - writeFields(String name, java.lang.Object obj, Class c, java.util.Map objectTable, IceUtilInternal.OutputBase out) + writeFields(String name, java.lang.Object obj, Class c, + java.util.Map<java.lang.Object, java.lang.Object> objectTable, IceUtilInternal.OutputBase out) { if(!c.equals(java.lang.Object.class)) { diff --git a/java/src/IceSSL/EndpointI.java b/java/src/IceSSL/EndpointI.java index 1e1572d493d..f9a64fe1b49 100644 --- a/java/src/IceSSL/EndpointI.java +++ b/java/src/IceSSL/EndpointI.java @@ -356,7 +356,7 @@ final class EndpointI extends IceInternal.EndpointI // Return connectors for this endpoint, or empty list if no connector // is available. // - public java.util.List + public java.util.List<IceInternal.Connector> connectors() { return connectors(IceInternal.Network.getAddresses(_host, _port, _instance.protocolSupport())); @@ -388,21 +388,22 @@ final class EndpointI extends IceInternal.EndpointI // Expand endpoint out in to separate endpoints for each local // host if listening on INADDR_ANY. // - public java.util.List + public java.util.List<IceInternal.EndpointI> expand() { - java.util.ArrayList endps = new java.util.ArrayList(); - java.util.ArrayList hosts = IceInternal.Network.getHostsForEndpointExpand(_host, _instance.protocolSupport()); + java.util.ArrayList<IceInternal.EndpointI> endps = new java.util.ArrayList<IceInternal.EndpointI>(); + java.util.ArrayList<String> hosts = + IceInternal.Network.getHostsForEndpointExpand(_host, _instance.protocolSupport()); if(hosts == null || hosts.isEmpty()) { endps.add(this); } else { - java.util.Iterator p = hosts.iterator(); + java.util.Iterator<String> p = hosts.iterator(); while(p.hasNext()) { - endps.add(new EndpointI(_instance, (String)p.next(), _port, _timeout, _connectionId, _compress)); + endps.add(new EndpointI(_instance, p.next(), _port, _timeout, _connectionId, _compress)); } } return endps; @@ -438,11 +439,19 @@ final class EndpointI extends IceInternal.EndpointI public boolean equals(java.lang.Object obj) { - return compareTo(obj) == 0; + try + { + return compareTo((IceInternal.EndpointI)obj) == 0; + } + catch(ClassCastException ee) + { + assert(false); + return false; + } } public int - compareTo(java.lang.Object obj) // From java.lang.Comparable + compareTo(IceInternal.EndpointI obj) // From java.lang.Comparable { EndpointI p = null; @@ -452,15 +461,7 @@ final class EndpointI extends IceInternal.EndpointI } catch(ClassCastException ex) { - try - { - IceInternal.EndpointI e = (IceInternal.EndpointI)obj; - return type() < e.type() ? -1 : 1; - } - catch(ClassCastException ee) - { - assert(false); - } + return type() < obj.type() ? -1 : 1; } if(this == p) @@ -503,14 +504,14 @@ final class EndpointI extends IceInternal.EndpointI return _host.compareTo(p._host); } - public java.util.List - connectors(java.util.List addresses) + public java.util.List<IceInternal.Connector> + connectors(java.util.List<java.net.InetSocketAddress> addresses) { - java.util.ArrayList connectors = new java.util.ArrayList(); - java.util.Iterator p = addresses.iterator(); + java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>(); + java.util.Iterator<java.net.InetSocketAddress> p = addresses.iterator(); while(p.hasNext()) { - connectors.add(new ConnectorI(_instance, (java.net.InetSocketAddress)p.next(), _timeout, _connectionId)); + connectors.add(new ConnectorI(_instance, p.next(), _timeout, _connectionId)); } return connectors; } diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java index 001a4af5863..7da138e6c78 100644 --- a/java/src/IceSSL/Instance.java +++ b/java/src/IceSSL/Instance.java @@ -659,10 +659,10 @@ class Instance CipherExpression ce = (CipherExpression)_ciphers[i]; if(ce.not) { - java.util.Iterator e = result.iterator(); + java.util.Iterator<String> e = result.iterator(); while(e.hasNext()) { - String cipher = (String)e.next(); + String cipher = e.next(); if(ce.cipher != null) { if(ce.cipher.equals(cipher)) @@ -752,16 +752,16 @@ class Instance { try { - java.util.Collection subjectAltNames = + java.util.Collection<java.util.List<?> > subjectAltNames = ((java.security.cert.X509Certificate)info.certs[0]).getSubjectAlternativeNames(); java.util.ArrayList<String> ipAddresses = new java.util.ArrayList<String>(); java.util.ArrayList<String> dnsNames = new java.util.ArrayList<String>(); if(subjectAltNames != null) { - java.util.Iterator i = subjectAltNames.iterator(); + java.util.Iterator<java.util.List<?> > i = subjectAltNames.iterator(); while(i.hasNext()) { - java.util.List l = (java.util.List)i.next(); + java.util.List<?> l = i.next(); assert(!l.isEmpty()); Integer n = (Integer)l.get(0); if(n.intValue() == 7) diff --git a/java/src/IceSSL/RFC2253.java b/java/src/IceSSL/RFC2253.java index 938210e963c..f7659f11b17 100644 --- a/java/src/IceSSL/RFC2253.java +++ b/java/src/IceSSL/RFC2253.java @@ -46,12 +46,12 @@ class RFC2253 int pos; } - public static java.util.List + public static java.util.List<java.util.List<RDNPair> > parse(String data) throws ParseException { - java.util.List results = new java.util.LinkedList(); - java.util.List current = new java.util.LinkedList(); + java.util.List<java.util.List<RDNPair> > results = new java.util.LinkedList<java.util.List<RDNPair> >(); + java.util.List<RDNPair> current = new java.util.LinkedList<RDNPair>(); ParseState state = new ParseState(); state.data = data; state.pos = 0; @@ -67,7 +67,7 @@ class RFC2253 { ++state.pos; results.add(current); - current = new java.util.LinkedList(); + current = new java.util.LinkedList<RDNPair>(); } else if(state.pos < state.data.length()) { @@ -82,11 +82,11 @@ class RFC2253 return results; } - public static java.util.List + public static java.util.List<RDNPair> parseStrict(String data) throws ParseException { - java.util.List results = new java.util.LinkedList(); + java.util.List<RDNPair> results = new java.util.LinkedList<RDNPair>(); ParseState state = new ParseState(); state.data = data; state.pos = 0; @@ -179,7 +179,7 @@ class RFC2253 // // Here we must also check for "oid." and "OID." before parsing // according to the ALPHA KEYCHAR* rule. - // + // // First the OID case. // if(Character.isDigit(state.data.charAt(state.pos)) || diff --git a/java/src/IceSSL/TrustManager.java b/java/src/IceSSL/TrustManager.java index 67b0066ac1d..443e3bc6b66 100644 --- a/java/src/IceSSL/TrustManager.java +++ b/java/src/IceSSL/TrustManager.java @@ -26,14 +26,14 @@ class TrustManager _client = parse(properties.getProperty(key)); key = "IceSSL.TrustOnly.Server"; _allServer = parse(properties.getProperty(key)); - java.util.Map dict = properties.getPropertiesForPrefix("IceSSL.TrustOnly.Server."); - java.util.Iterator p = dict.entrySet().iterator(); + java.util.Map<String, String> dict = properties.getPropertiesForPrefix("IceSSL.TrustOnly.Server."); + java.util.Iterator<java.util.Map.Entry<String, String> > p = dict.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - key = (String)entry.getKey(); + java.util.Map.Entry<String, String> entry = p.next(); + key = entry.getKey(); String name = key.substring("IceSSL.TrustOnly.Server.".length()); - _server.put(name, parse((String)entry.getValue())); + _server.put(name, parse(entry.getValue())); } } catch(RFC2253.ParseException e) @@ -47,7 +47,8 @@ class TrustManager boolean verify(ConnectionInfo info) { - java.util.List trustset = new java.util.LinkedList(); + java.util.List<java.util.List<java.util.List<RFC2253.RDNPair> > > trustset = + new java.util.LinkedList<java.util.List<java.util.List<RFC2253.RDNPair> > >(); if(!_all.isEmpty()) { trustset.add(_all); @@ -61,7 +62,7 @@ class TrustManager } if(info.adapterName.length() > 0) { - java.util.List p = (java.util.List)_server.get(info.adapterName); + java.util.List<java.util.List<RFC2253.RDNPair> > p = _server.get(info.adapterName); if(p != null) { trustset.add(p); @@ -116,19 +117,19 @@ class TrustManager "remote addr = " + IceInternal.Network.addrToString(info.remoteAddr)); } } - java.util.List dn = RFC2253.parseStrict(subjectName); + java.util.List<RFC2253.RDNPair> dn = RFC2253.parseStrict(subjectName); // // Try matching against everything in the trust set. // - java.util.Iterator p = trustset.iterator(); + java.util.Iterator<java.util.List<java.util.List<RFC2253.RDNPair> > > p = trustset.iterator(); while(p.hasNext()) { - java.util.List matchSet = (java.util.List)p.next(); + java.util.List<java.util.List<RFC2253.RDNPair> > matchSet = p.next(); if(_traceLevel > 1) { String s = "trust manager matching PDNs:\n"; - java.util.Iterator q = matchSet.iterator(); + java.util.Iterator<java.util.List<RFC2253.RDNPair> > q = matchSet.iterator(); boolean addSemi = false; while(q.hasNext()) { @@ -137,8 +138,8 @@ class TrustManager s += ';'; } addSemi = true; - java.util.List rdnSet = (java.util.List)q.next(); - java.util.Iterator r = rdnSet.iterator(); + java.util.List<RFC2253.RDNPair> rdnSet = q.next(); + java.util.Iterator<RFC2253.RDNPair> r = rdnSet.iterator(); boolean addComma = false; while(r.hasNext()) { @@ -147,7 +148,7 @@ class TrustManager s += ','; } addComma = true; - RFC2253.RDNPair rdn = (RFC2253.RDNPair)r.next(); + RFC2253.RDNPair rdn = r.next(); s += rdn.key; s += '='; s += rdn.value; @@ -172,12 +173,12 @@ class TrustManager } private boolean - match(java.util.List matchSet, java.util.List subject) + match(java.util.List<java.util.List<RFC2253.RDNPair> > matchSet, java.util.List<RFC2253.RDNPair> subject) { - java.util.Iterator r = matchSet.iterator(); + java.util.Iterator<java.util.List<RFC2253.RDNPair> > r = matchSet.iterator(); while(r.hasNext()) { - if(matchRDNs((java.util.List)r.next(), subject)) + if(matchRDNs(r.next(), subject)) { return true; } @@ -186,17 +187,17 @@ class TrustManager } private boolean - matchRDNs(java.util.List match, java.util.List subject) + matchRDNs(java.util.List<RFC2253.RDNPair> match, java.util.List<RFC2253.RDNPair> subject) { - java.util.Iterator p = match.iterator(); + java.util.Iterator<RFC2253.RDNPair> p = match.iterator(); while(p.hasNext()) { - RFC2253.RDNPair matchRDN = (RFC2253.RDNPair)p.next(); + RFC2253.RDNPair matchRDN = p.next(); boolean found = false; - java.util.Iterator q = subject.iterator(); + java.util.Iterator<RFC2253.RDNPair> q = subject.iterator(); while(q.hasNext()) { - RFC2253.RDNPair subjectRDN = (RFC2253.RDNPair)q.next(); + RFC2253.RDNPair subjectRDN = q.next(); if(matchRDN.key.equals(subjectRDN.key)) { found = true; @@ -214,7 +215,7 @@ class TrustManager return true; } - java.util.List + java.util.List<java.util.List<RFC2253.RDNPair> > parse(String value) throws RFC2253.ParseException { @@ -257,15 +258,16 @@ class TrustManager // DNs on ';' which cannot be blindly split because of quotes, // \ and such. // - java.util.List l = RFC2253.parse(value); - java.util.List result = new java.util.LinkedList(); - java.util.Iterator p = l.iterator(); + java.util.List<java.util.List<RFC2253.RDNPair> > l = RFC2253.parse(value); + java.util.List<java.util.List<RFC2253.RDNPair> > result = + new java.util.LinkedList<java.util.List<RFC2253.RDNPair> >(); + java.util.Iterator<java.util.List<RFC2253.RDNPair> > p = l.iterator(); while(p.hasNext()) { - java.util.List dn = (java.util.List)p.next(); + java.util.List<RFC2253.RDNPair> dn = p.next(); String v = new String(); boolean first = true; - java.util.Iterator q = dn.iterator(); + java.util.Iterator<RFC2253.RDNPair> q = dn.iterator(); while(q.hasNext()) { if(!first) @@ -273,7 +275,7 @@ class TrustManager v += ","; } first = false; - RFC2253.RDNPair pair = (RFC2253.RDNPair)q.next(); + RFC2253.RDNPair pair = q.next(); v += pair.key; v += "="; v += pair.value; @@ -288,8 +290,9 @@ class TrustManager private Ice.Communicator _communicator; private int _traceLevel; - private java.util.List _all; - private java.util.List _client; - private java.util.List _allServer; - private java.util.Map _server = new java.util.HashMap(); + private java.util.List<java.util.List<RFC2253.RDNPair> > _all; + private java.util.List<java.util.List<RFC2253.RDNPair> > _client; + private java.util.List<java.util.List<RFC2253.RDNPair> > _allServer; + private java.util.Map<String, java.util.List<java.util.List<RFC2253.RDNPair> > > _server = + new java.util.HashMap<String, java.util.List<java.util.List<RFC2253.RDNPair> > >(); } diff --git a/java/src/IceUtil/Cache.java b/java/src/IceUtil/Cache.java index 3fc15b078e2..f832645c00a 100644 --- a/java/src/IceUtil/Cache.java +++ b/java/src/IceUtil/Cache.java @@ -20,8 +20,8 @@ public class Cache { _store = store; } - - public Object + + public Object getIfPinned(Object key) { synchronized(_map) @@ -30,7 +30,7 @@ public class Cache return val == null ? null : val.obj; } } - + public Object unpin(Object key) { @@ -49,7 +49,7 @@ public class Cache _map.clear(); } } - + public int size() { @@ -105,7 +105,6 @@ public class Cache return pinImpl(key, newObj); } - static private class CacheValue { CacheValue() @@ -128,34 +127,34 @@ public class Cache { CacheValue val = null; java.util.concurrent.CountDownLatch latch = null; - + synchronized(_map) { - val = (CacheValue)_map.get(key); - if(val == null) - { - val = new CacheValue(); - _map.put(key, val); - } - else - { - if(val.obj != null) - { - return val.obj; - } - if(val.latch == null) - { - // - // The first queued thread creates the latch - // - val.latch = new java.util.concurrent.CountDownLatch(1); - } - latch = val.latch; - } + val = (CacheValue)_map.get(key); + if(val == null) + { + val = new CacheValue(); + _map.put(key, val); + } + else + { + if(val.obj != null) + { + return val.obj; + } + if(val.latch == null) + { + // + // The first queued thread creates the latch + // + val.latch = new java.util.concurrent.CountDownLatch(1); + } + latch = val.latch; + } } - - if(latch != null) - { + + if(latch != null) + { try { latch.await(); @@ -164,16 +163,16 @@ public class Cache { // Ignored } - - // - // val could be stale now, e.g. some other thread pinned and unpinned the - // object while we were waiting. - // So start over. - // + + // + // val could be stale now, e.g. some other thread pinned and unpinned the + // object while we were waiting. + // So start over. + // continue; - } - else - { + } + else + { Object obj; try { @@ -181,37 +180,37 @@ public class Cache } catch(RuntimeException e) { - synchronized(_map) + synchronized(_map) { _map.remove(key); - latch = val.latch; - val.latch = null; + latch = val.latch; + val.latch = null; } - if(latch != null) - { + if(latch != null) + { latch.countDown(); assert latch.getCount() == 0; } throw e; } - - synchronized(_map) - { - if(obj != null) - { - val.obj = obj; - } - else - { + + synchronized(_map) + { + if(obj != null) + { + val.obj = obj; + } + else + { if(newObj == null) { // // pin() did not find the object // - - // - // The waiting threads will have to call load() to see by themselves. - // + + // + // The waiting threads will have to call load() to see by themselves. + // _map.remove(key); } else @@ -221,23 +220,21 @@ public class Cache // val.obj = newObj; } - } - - latch = val.latch; - val.latch = null; - } - if(latch != null) - { + } + + latch = val.latch; + val.latch = null; + } + if(latch != null) + { latch.countDown(); assert latch.getCount() == 0; - } + } return obj; - } + } } } - - private final java.util.Map _map = new java.util.HashMap(); + private final java.util.Map<Object, CacheValue> _map = new java.util.HashMap<Object, CacheValue>(); private final Store _store; - } diff --git a/java/src/IceUtilInternal/Options.java b/java/src/IceUtilInternal/Options.java index 114e434e881..cc9058fa046 100644 --- a/java/src/IceUtilInternal/Options.java +++ b/java/src/IceUtilInternal/Options.java @@ -38,7 +38,7 @@ public final class Options int state = NormalState; StringBuffer arg = new StringBuffer(); - java.util.List vec = new java.util.ArrayList(); + java.util.List<String> vec = new java.util.ArrayList<String>(); for(int i = 0; i < line.length(); ++i) { diff --git a/java/src/IceUtilInternal/OutputBase.java b/java/src/IceUtilInternal/OutputBase.java index 2a160aab72c..895f231f620 100644 --- a/java/src/IceUtilInternal/OutputBase.java +++ b/java/src/IceUtilInternal/OutputBase.java @@ -107,14 +107,14 @@ public class OutputBase public void useCurrentPosAsIndent() { - _indentSave.addFirst(new Integer(_indent)); + _indentSave.addFirst(_indent); _indent = _pos; } public void zeroIndent() { - _indentSave.addFirst(new Integer(_indent)); + _indentSave.addFirst(_indent); _indent = 0; } @@ -122,7 +122,7 @@ public class OutputBase restoreIndent() { assert(!_indentSave.isEmpty()); - _indent = ((Integer)_indentSave.removeFirst()).intValue(); + _indent = _indentSave.removeFirst().intValue(); } public void @@ -182,8 +182,7 @@ public class OutputBase protected int _pos; protected int _indent; protected int _indentSize; - protected java.util.LinkedList _indentSave = new java.util.LinkedList(); + protected java.util.LinkedList<Integer> _indentSave = new java.util.LinkedList<Integer>(); protected boolean _useTab; protected boolean _separator; - } diff --git a/java/src/IceUtilInternal/XMLOutput.java b/java/src/IceUtilInternal/XMLOutput.java index e4562608d76..dec906ae4a7 100644 --- a/java/src/IceUtilInternal/XMLOutput.java +++ b/java/src/IceUtilInternal/XMLOutput.java @@ -132,7 +132,7 @@ public class XMLOutput extends OutputBase public XMLOutput ee() { - String element = (String)_elementStack.removeFirst(); + String element = _elementStack.removeFirst(); dec(); if(_se) @@ -202,7 +202,7 @@ public class XMLOutput extends OutputBase { if(_elementStack.size() > 0) { - return (String)_elementStack.getFirst(); + return _elementStack.getFirst(); } else { @@ -263,7 +263,7 @@ public class XMLOutput extends OutputBase return v; } - private java.util.LinkedList _elementStack = new java.util.LinkedList(); + private java.util.LinkedList<String> _elementStack = new java.util.LinkedList<String>(); boolean _se; boolean _text; diff --git a/java/test/Freeze/complex/build.xml b/java/test/Freeze/complex/build.xml index 18260450672..30134d17c4d 100644 --- a/java/test/Freeze/complex/build.xml +++ b/java/test/Freeze/complex/build.xml @@ -34,12 +34,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Freeze/dbmap/build.xml b/java/test/Freeze/dbmap/build.xml index c734f6ca8ac..1f74e17f5d8 100644 --- a/java/test/Freeze/dbmap/build.xml +++ b/java/test/Freeze/dbmap/build.xml @@ -56,12 +56,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Freeze/evictor/build.xml b/java/test/Freeze/evictor/build.xml index 4742e196a35..b6d41b0cc24 100644 --- a/java/test/Freeze/evictor/build.xml +++ b/java/test/Freeze/evictor/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Freeze/oldevictor/build.xml b/java/test/Freeze/oldevictor/build.xml index d98d83abe80..c5cb5bbe55f 100644 --- a/java/test/Freeze/oldevictor/build.xml +++ b/java/test/Freeze/oldevictor/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Glacier2/attack/AttackClient.java b/java/test/Glacier2/attack/AttackClient.java index 8a926603292..eacaf831ffc 100644 --- a/java/test/Glacier2/attack/AttackClient.java +++ b/java/test/Glacier2/attack/AttackClient.java @@ -44,7 +44,7 @@ class AttackClient extends Ice.Application BackendPrx backend = BackendPrxHelper.uncheckedCast(backendBase); backend.ice_ping(); - java.util.HashMap backends = new java.util.HashMap(); + java.util.Map<BackendPrx, BackendPrx> backends = new java.util.HashMap<BackendPrx, BackendPrx>(); java.util.Random rand = new java.util.Random(); String msg = ""; @@ -85,7 +85,7 @@ class AttackClient extends Ice.Application } else { - backend = (BackendPrx)backends.get(newBackend); + backend = backends.get(newBackend); } backend.ice_ping(); diff --git a/java/test/Glacier2/attack/build.xml b/java/test/Glacier2/attack/build.xml index 21b4355c2a2..24877fb4192 100644 --- a/java/test/Glacier2/attack/build.xml +++ b/java/test/Glacier2/attack/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Glacier2/router/CallbackClient.java b/java/test/Glacier2/router/CallbackClient.java index 6a8b5ef0156..723eabd0c10 100644 --- a/java/test/Glacier2/router/CallbackClient.java +++ b/java/test/Glacier2/router/CallbackClient.java @@ -221,7 +221,7 @@ class CallbackClient extends Ice.Application System.out.flush(); CallbackPrx oneway = CallbackPrxHelper.uncheckedCast(twoway.ice_oneway()); CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway()); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "o"); oneway.initiateCallback(onewayR, context); test(callbackReceiverImpl.callbackOK()); @@ -231,7 +231,7 @@ class CallbackClient extends Ice.Application { System.out.print("testing twoway callback... "); System.out.flush(); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); twoway.initiateCallback(twowayR, context); test(callbackReceiverImpl.callbackOK()); @@ -241,7 +241,7 @@ class CallbackClient extends Ice.Application { System.out.print("ditto, but with user exception... "); System.out.flush(); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); try { @@ -260,7 +260,7 @@ class CallbackClient extends Ice.Application { System.out.print("trying twoway callback with fake category... "); System.out.flush(); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); try { @@ -276,7 +276,7 @@ class CallbackClient extends Ice.Application { System.out.print("testing whether other allowed category is accepted... "); System.out.flush(); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( twoway.ice_identity(communicator().stringToIdentity("c2/callback"))); @@ -288,7 +288,7 @@ class CallbackClient extends Ice.Application { System.out.print("testing whether disallowed category gets rejected... "); System.out.flush(); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); try { @@ -306,7 +306,7 @@ class CallbackClient extends Ice.Application { System.out.print("testing whether user-id as category is accepted... "); System.out.flush(); - java.util.Map context = new java.util.HashMap(); + java.util.Map<String, String> context = new java.util.HashMap<String, String>(); context.put("_fwd", "t"); CallbackPrx otherCategoryTwoway = CallbackPrxHelper.uncheckedCast( twoway.ice_identity(communicator().stringToIdentity("_userid/callback"))); diff --git a/java/test/Glacier2/router/build.xml b/java/test/Glacier2/router/build.xml index db5a4e873ea..2cdebe07b0e 100644 --- a/java/test/Glacier2/router/build.xml +++ b/java/test/Glacier2/router/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/adapterDeactivation/build.xml b/java/test/Ice/adapterDeactivation/build.xml index 6c19d4c06cc..ce2183f7f69 100644 --- a/java/test/Ice/adapterDeactivation/build.xml +++ b/java/test/Ice/adapterDeactivation/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/background/AllTests.java b/java/test/Ice/background/AllTests.java index f3cc846f87e..06c04b43b7e 100644 --- a/java/test/Ice/background/AllTests.java +++ b/java/test/Ice/background/AllTests.java @@ -111,7 +111,7 @@ public class AllTests } public synchronized void - destroy() + _destroy() // Thread.destroy is deprecated { _destroyed = true; } @@ -407,8 +407,8 @@ public class AllTests } } - thread1.destroy(); - thread2.destroy(); + thread1._destroy(); + thread2._destroy(); try { @@ -642,8 +642,8 @@ public class AllTests } } - thread1.destroy(); - thread2.destroy(); + thread1._destroy(); + thread2._destroy(); try { @@ -1162,8 +1162,8 @@ public class AllTests background.ice_getCachedConnection().close(true); } - thread1.destroy(); - thread2.destroy(); + thread1._destroy(); + thread2._destroy(); try { diff --git a/java/test/Ice/background/BackgroundControllerI.java b/java/test/Ice/background/BackgroundControllerI.java index 890b47de122..828ef9cf47e 100644 --- a/java/test/Ice/background/BackgroundControllerI.java +++ b/java/test/Ice/background/BackgroundControllerI.java @@ -112,6 +112,6 @@ class BackgroundControllerI extends _BackgroundControllerDisp } final private Ice.ObjectAdapter _adapter; - final private java.util.HashSet _pausedCalls = new java.util.HashSet(); + final private java.util.Set<String> _pausedCalls = new java.util.HashSet<String>(); final private Configuration _configuration; } diff --git a/java/test/Ice/background/EndpointI.java b/java/test/Ice/background/EndpointI.java index 52b8e68b6c1..4286c0d9365 100644 --- a/java/test/Ice/background/EndpointI.java +++ b/java/test/Ice/background/EndpointI.java @@ -182,15 +182,15 @@ final class EndpointI extends IceInternal.EndpointI // Return connectors for this endpoint, or empty list if no connector // is available. // - public java.util.List + public java.util.List<IceInternal.Connector> connectors() { _configuration.checkConnectorsException(); - java.util.ArrayList connectors = new java.util.ArrayList(); - java.util.Iterator p = _endpoint.connectors().iterator(); + java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>(); + java.util.Iterator<IceInternal.Connector> p = _endpoint.connectors().iterator(); while(p.hasNext()) { - connectors.add(new Connector((IceInternal.Connector)p.next())); + connectors.add(new Connector(p.next())); } return connectors; } @@ -201,13 +201,13 @@ final class EndpointI extends IceInternal.EndpointI class Callback implements IceInternal.EndpointI_connectors { public void - connectors(java.util.List cons) + connectors(java.util.List<IceInternal.Connector> cons) { - java.util.ArrayList connectors = new java.util.ArrayList(); - java.util.Iterator p = cons.iterator(); + java.util.List<IceInternal.Connector> connectors = new java.util.ArrayList<IceInternal.Connector>(); + java.util.Iterator<IceInternal.Connector> p = cons.iterator(); while(p.hasNext()) { - connectors.add(new Connector((IceInternal.Connector)p.next())); + connectors.add(new Connector(p.next())); } cb.connectors(connectors); } @@ -238,14 +238,14 @@ final class EndpointI extends IceInternal.EndpointI return p; } - public java.util.List + public java.util.List<IceInternal.EndpointI> expand() { - java.util.ArrayList endps = new java.util.ArrayList(); - java.util.Iterator iter = _endpoint.expand().iterator(); + java.util.List<IceInternal.EndpointI> endps = new java.util.ArrayList<IceInternal.EndpointI>(); + java.util.Iterator<IceInternal.EndpointI> iter = _endpoint.expand().iterator(); while(iter.hasNext()) { - IceInternal.EndpointI endpt = (IceInternal.EndpointI)iter.next(); + IceInternal.EndpointI endpt = iter.next(); endps.add(endpt == _endpoint ? this : new EndpointI(endpt)); } return endps; @@ -278,11 +278,19 @@ final class EndpointI extends IceInternal.EndpointI public boolean equals(java.lang.Object obj) { - return compareTo(obj) == 0; + try + { + return compareTo((IceInternal.EndpointI)obj) == 0; + } + catch(ClassCastException ee) + { + assert(false); + return false; + } } public int - compareTo(java.lang.Object obj) // From java.lang.Comparable + compareTo(IceInternal.EndpointI obj) // From java.lang.Comparable { EndpointI p = null; @@ -292,15 +300,7 @@ final class EndpointI extends IceInternal.EndpointI } catch(ClassCastException ex) { - try - { - IceInternal.EndpointI e = (IceInternal.EndpointI)obj; - return type() < e.type() ? -1 : 1; - } - catch(ClassCastException ee) - { - assert(false); - } + return type() < obj.type() ? -1 : 1; } if(this == p) diff --git a/java/test/Ice/background/Server.java b/java/test/Ice/background/Server.java index abd24ec7f4e..23f6a3879d0 100644 --- a/java/test/Ice/background/Server.java +++ b/java/test/Ice/background/Server.java @@ -58,6 +58,9 @@ public class Server return null; } + /** + * @deprecated addProxy() is deprecated, use addProxies() instead. + **/ public void addProxy(Ice.ObjectPrx proxy, Ice.Current current) { diff --git a/java/test/Ice/background/build.xml b/java/test/Ice/background/build.xml index e9117bf7755..07ef3bae04b 100644 --- a/java/test/Ice/background/build.xml +++ b/java/test/Ice/background/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/binding/AllTests.java b/java/test/Ice/binding/AllTests.java index 66733793bc9..9ff8feb7644 100644 --- a/java/test/Ice/binding/AllTests.java +++ b/java/test/Ice/binding/AllTests.java @@ -22,7 +22,7 @@ public class AllTests static class GetAdapterNameCB extends AMI_TestIntf_getAdapterName { - synchronized public void + synchronized public void ice_response(String adapterName) { _name = adapterName; @@ -56,9 +56,9 @@ public class AllTests } return _name; } - + private String _name = null; - }; + } private static String getAdapterNameWithAMI(TestIntfPrx test) @@ -69,14 +69,14 @@ public class AllTests } private static TestIntfPrx - createTestIntfPrx(java.util.List adapters) + createTestIntfPrx(java.util.List<RemoteObjectAdapterPrx> adapters) { - java.util.List endpoints = new java.util.ArrayList(); + java.util.List<Ice.Endpoint> endpoints = new java.util.ArrayList<Ice.Endpoint>(); TestIntfPrx test = null; - java.util.Iterator p = adapters.iterator(); + java.util.Iterator<RemoteObjectAdapterPrx> p = adapters.iterator(); while(p.hasNext()) { - test = ((RemoteObjectAdapterPrx)p.next()).getTestIntf(); + test = p.next().getTestIntf(); Ice.Endpoint[] edpts = test.ice_getEndpoints(); endpoints.addAll(java.util.Arrays.asList(edpts)); } @@ -85,12 +85,12 @@ public class AllTests } private static void - deactivate(RemoteCommunicatorPrx communicator, java.util.List adapters) + deactivate(RemoteCommunicatorPrx communicator, java.util.List<RemoteObjectAdapterPrx> adapters) { - java.util.Iterator p = adapters.iterator(); + java.util.Iterator<RemoteObjectAdapterPrx> p = adapters.iterator(); while(p.hasNext()) { - communicator.deactivateObjectAdapter((RemoteObjectAdapterPrx)p.next()); + communicator.deactivateObjectAdapter(p.next()); } } @@ -111,9 +111,9 @@ public class AllTests test1.ice_ping(); test2.ice_ping(); - + com.deactivateObjectAdapter(adapter); - + TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); test(test3.ice_getConnection() == test1.ice_getConnection()); test(test3.ice_getConnection() == test2.ice_getConnection()); @@ -132,7 +132,7 @@ public class AllTests System.out.print("testing binding with multiple endpoints... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter11", "default")); adapters.add(com.createObjectAdapter("Adapter12", "default")); adapters.add(com.createObjectAdapter("Adapter13", "default")); @@ -141,13 +141,14 @@ public class AllTests // Ensure that when a connection is opened it's reused for new // proxies and that all endpoints are eventually tried. // - java.util.Set names = new java.util.HashSet(); + java.util.Set<String> names = new java.util.HashSet<String>(); names.add("Adapter11"); names.add("Adapter12"); names.add("Adapter13"); while(!names.isEmpty()) { - java.util.List adpts = new java.util.ArrayList(adapters); + java.util.List<RemoteObjectAdapterPrx> adpts = + new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); java.util.Collections.shuffle(adpts); @@ -157,7 +158,7 @@ public class AllTests test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); - + names.remove(test1.getAdapterName()); test1.ice_getConnection().close(false); } @@ -167,12 +168,12 @@ public class AllTests // always send the request over the same connection.) // { - java.util.Iterator p = adapters.iterator(); + java.util.Iterator<RemoteObjectAdapterPrx> p = adapters.iterator(); while(p.hasNext()) { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_ping(); + p.next().getTestIntf().ice_ping(); } - + TestIntfPrx test = createTestIntfPrx(adapters); String name = test.getAdapterName(); final int nRetry = 10; @@ -183,39 +184,40 @@ public class AllTests p = adapters.iterator(); while(p.hasNext()) { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_getConnection().close(false); + p.next().getTestIntf().ice_getConnection().close(false); } - } + } // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapters. // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); names.add("Adapter12"); names.add("Adapter13"); while(!names.isEmpty()) { - java.util.List adpts = new java.util.ArrayList(adapters); + java.util.List<RemoteObjectAdapterPrx> adpts = + new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); java.util.Collections.shuffle(adpts); TestIntfPrx test2 = createTestIntfPrx(adpts); java.util.Collections.shuffle(adpts); TestIntfPrx test3 = createTestIntfPrx(adpts); - + test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); names.remove(test1.getAdapterName()); test1.ice_getConnection().close(false); } - + // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapter. // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); + com.deactivateObjectAdapter(adapters.get(2)); TestIntfPrx test = createTestIntfPrx(adapters); test(test.getAdapterName().equals("Adapter12")); @@ -226,7 +228,7 @@ public class AllTests System.out.print("testing binding with multiple endpoints and AMI... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("AdapterAMI11", "default")); adapters.add(com.createObjectAdapter("AdapterAMI12", "default")); adapters.add(com.createObjectAdapter("AdapterAMI13", "default")); @@ -235,13 +237,14 @@ public class AllTests // Ensure that when a connection is opened it's reused for new // proxies and that all endpoints are eventually tried. // - java.util.Set names = new java.util.HashSet(); + java.util.Set<String> names = new java.util.HashSet<String>(); names.add("AdapterAMI11"); names.add("AdapterAMI12"); names.add("AdapterAMI13"); while(!names.isEmpty()) { - java.util.List adpts = new java.util.ArrayList(adapters); + java.util.List<RemoteObjectAdapterPrx> adpts = + new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); java.util.Collections.shuffle(adpts); @@ -251,7 +254,7 @@ public class AllTests test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); - + names.remove(getAdapterNameWithAMI(test1)); test1.ice_getConnection().close(false); } @@ -261,12 +264,12 @@ public class AllTests // always send the request over the same connection.) // { - java.util.Iterator p = adapters.iterator(); + java.util.Iterator<RemoteObjectAdapterPrx> p = adapters.iterator(); while(p.hasNext()) { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_ping(); + p.next().getTestIntf().ice_ping(); } - + TestIntfPrx test = createTestIntfPrx(adapters); String name = getAdapterNameWithAMI(test); final int nRetry = 10; @@ -277,39 +280,40 @@ public class AllTests p = adapters.iterator(); while(p.hasNext()) { - ((RemoteObjectAdapterPrx)p.next()).getTestIntf().ice_getConnection().close(false); + p.next().getTestIntf().ice_getConnection().close(false); } - } + } // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapters. // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); names.add("AdapterAMI12"); names.add("AdapterAMI13"); while(!names.isEmpty()) { - java.util.List adpts = new java.util.ArrayList(adapters); + java.util.List<RemoteObjectAdapterPrx> adpts = + new java.util.ArrayList<RemoteObjectAdapterPrx>(adapters); TestIntfPrx test1 = createTestIntfPrx(adpts); java.util.Collections.shuffle(adpts); TestIntfPrx test2 = createTestIntfPrx(adpts); java.util.Collections.shuffle(adpts); TestIntfPrx test3 = createTestIntfPrx(adpts); - + test(test1.ice_getConnection() == test2.ice_getConnection()); test(test2.ice_getConnection() == test3.ice_getConnection()); names.remove(getAdapterNameWithAMI(test1)); test1.ice_getConnection().close(false); } - + // // Deactivate an adapter and ensure that we can still // establish the connection to the remaining adapter. // - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); + com.deactivateObjectAdapter(adapters.get(2)); TestIntfPrx test = createTestIntfPrx(adapters); test(getAdapterNameWithAMI(test).equals("AdapterAMI12")); @@ -320,7 +324,7 @@ public class AllTests System.out.print("testing random endpoint selection... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter21", "default")); adapters.add(com.createObjectAdapter("Adapter22", "default")); adapters.add(com.createObjectAdapter("Adapter23", "default")); @@ -328,7 +332,7 @@ public class AllTests TestIntfPrx test = createTestIntfPrx(adapters); test(test.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random); - java.util.Set names = new java.util.HashSet(); + java.util.Set<String> names = new java.util.HashSet<String>(); names.add("Adapter21"); names.add("Adapter22"); names.add("Adapter23"); @@ -357,7 +361,7 @@ public class AllTests System.out.print("testing ordered endpoint selection... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter31", "default")); adapters.add(com.createObjectAdapter("Adapter32", "default")); adapters.add(com.createObjectAdapter("Adapter33", "default")); @@ -374,14 +378,14 @@ public class AllTests // for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter31"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter32"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); + com.deactivateObjectAdapter(adapters.get(1)); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter33"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - + com.deactivateObjectAdapter(adapters.get(2)); + try { test.getAdapterName(); @@ -397,7 +401,7 @@ public class AllTests // // Now, re-activate the adapters with the same endpoints in the opposite // order. - // + // adapters.add(com.createObjectAdapter("Adapter36", endpoints[2].toString())); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter36"); i++); test(i == nRetry); @@ -426,9 +430,9 @@ public class AllTests test(test1.ice_getConnection() == test2.ice_getConnection()); test1.ice_ping(); - + com.deactivateObjectAdapter(adapter); - + TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1); try { @@ -444,7 +448,7 @@ public class AllTests System.out.print("testing per request binding with multiple endpoints... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter51", "default")); adapters.add(com.createObjectAdapter("Adapter52", "default")); adapters.add(com.createObjectAdapter("Adapter53", "default")); @@ -452,7 +456,7 @@ public class AllTests TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); test(!test.ice_isConnectionCached()); - java.util.Set names = new java.util.HashSet(); + java.util.Set<String> names = new java.util.HashSet<String>(); names.add("Adapter51"); names.add("Adapter52"); names.add("Adapter53"); @@ -461,7 +465,7 @@ public class AllTests names.remove(test.getAdapterName()); } - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); names.add("Adapter52"); names.add("Adapter53"); @@ -470,11 +474,10 @@ public class AllTests names.remove(test.getAdapterName()); } - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - + com.deactivateObjectAdapter(adapters.get(2)); test(test.getAdapterName().equals("Adapter52")); - + deactivate(com, adapters); } System.out.println("ok"); @@ -482,7 +485,7 @@ public class AllTests System.out.print("testing per request binding with multiple endpoints and AMI... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("AdapterAMI51", "default")); adapters.add(com.createObjectAdapter("AdapterAMI52", "default")); adapters.add(com.createObjectAdapter("AdapterAMI53", "default")); @@ -490,7 +493,7 @@ public class AllTests TestIntfPrx test = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false)); test(!test.ice_isConnectionCached()); - java.util.Set names = new java.util.HashSet(); + java.util.Set<String> names = new java.util.HashSet<String>(); names.add("AdapterAMI51"); names.add("AdapterAMI52"); names.add("AdapterAMI53"); @@ -499,7 +502,7 @@ public class AllTests names.remove(getAdapterNameWithAMI(test)); } - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); names.add("AdapterAMI52"); names.add("AdapterAMI53"); @@ -508,11 +511,10 @@ public class AllTests names.remove(getAdapterNameWithAMI(test)); } - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - + com.deactivateObjectAdapter(adapters.get(2)); test(getAdapterNameWithAMI(test).equals("AdapterAMI52")); - + deactivate(com, adapters); } System.out.println("ok"); @@ -520,7 +522,7 @@ public class AllTests System.out.print("testing per request binding and ordered endpoint selection... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter61", "default")); adapters.add(com.createObjectAdapter("Adapter62", "default")); adapters.add(com.createObjectAdapter("Adapter63", "default")); @@ -539,14 +541,14 @@ public class AllTests // for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter61"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter62"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); + com.deactivateObjectAdapter(adapters.get(1)); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter63"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - + com.deactivateObjectAdapter(adapters.get(2)); + try { test.getAdapterName(); @@ -562,7 +564,7 @@ public class AllTests // // Now, re-activate the adapters with the same endpoints in the opposite // order. - // + // adapters.add(com.createObjectAdapter("Adapter66", endpoints[2].toString())); for(i = 0; i < nRetry && test.getAdapterName().equals("Adapter66"); i++); test(i == nRetry); @@ -580,7 +582,7 @@ public class AllTests System.out.print("testing per request binding and ordered endpoint selection and AMI... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("AdapterAMI61", "default")); adapters.add(com.createObjectAdapter("AdapterAMI62", "default")); adapters.add(com.createObjectAdapter("AdapterAMI63", "default")); @@ -599,14 +601,14 @@ public class AllTests // for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI61"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI62"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); + com.deactivateObjectAdapter(adapters.get(1)); for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI63"); i++); test(i == nRetry); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(2)); - + com.deactivateObjectAdapter(adapters.get(2)); + try { test.getAdapterName(); @@ -622,7 +624,7 @@ public class AllTests // // Now, re-activate the adapters with the same endpoints in the opposite // order. - // + // adapters.add(com.createObjectAdapter("AdapterAMI66", endpoints[2].toString())); for(i = 0; i < nRetry && getAdapterNameWithAMI(test).equals("AdapterAMI66"); i++); test(i == nRetry); @@ -640,13 +642,13 @@ public class AllTests System.out.print("testing endpoint mode filtering... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter71", "default")); adapters.add(com.createObjectAdapter("Adapter72", "udp")); TestIntfPrx test = createTestIntfPrx(adapters); test(test.getAdapterName().equals("Adapter71")); - + TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(test.ice_datagram()); test(test.ice_getConnection() != testUDP.ice_getConnection()); try @@ -664,10 +666,10 @@ public class AllTests System.out.print("testing unsecure vs. secure endpoints... "); System.out.flush(); { - java.util.List adapters = new java.util.ArrayList(); + java.util.List<RemoteObjectAdapterPrx> adapters = new java.util.ArrayList<RemoteObjectAdapterPrx>(); adapters.add(com.createObjectAdapter("Adapter81", "ssl")); adapters.add(com.createObjectAdapter("Adapter82", "tcp")); - + TestIntfPrx test = createTestIntfPrx(adapters); int i; for(i = 0; i < 5; i++) @@ -675,7 +677,7 @@ public class AllTests test(test.getAdapterName().equals("Adapter82")); test.ice_getConnection().close(false); } - + TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(true)); test(testSecure.ice_isSecure()); testSecure = TestIntfPrxHelper.uncheckedCast(test.ice_secure(false)); @@ -684,8 +686,8 @@ public class AllTests test(testSecure.ice_isSecure()); test(test.ice_getConnection() != testSecure.ice_getConnection()); - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(1)); - + com.deactivateObjectAdapter(adapters.get(1)); + for(i = 0; i < 5; i++) { test(test.getAdapterName().equals("Adapter81")); @@ -700,7 +702,7 @@ public class AllTests test.ice_getConnection().close(false); } - com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters.get(0)); + com.deactivateObjectAdapter(adapters.get(0)); try { testSecure.ice_ping(); @@ -716,6 +718,5 @@ public class AllTests } com.shutdown(); - } } diff --git a/java/test/Ice/binding/build.xml b/java/test/Ice/binding/build.xml index 3ebfab74fbd..a03f235d310 100644 --- a/java/test/Ice/binding/build.xml +++ b/java/test/Ice/binding/build.xml @@ -32,10 +32,10 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> + classpathref="ice.classpath" debug="${debug}"> <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> </javac> diff --git a/java/test/Ice/checksum/client/AllTests.java b/java/test/Ice/checksum/client/AllTests.java index 68ddcc31a36..a3eba83c210 100644 --- a/java/test/Ice/checksum/client/AllTests.java +++ b/java/test/Ice/checksum/client/AllTests.java @@ -33,11 +33,11 @@ public class AllTests // System.out.print("testing checksums... "); System.out.flush(); - java.util.Iterator p = SliceChecksums.checksums.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, String> > p = SliceChecksums.checksums.entrySet().iterator(); while(p.hasNext()) { - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - String key = (String)entry.getKey(); + java.util.Map.Entry<String, String> entry = p.next(); + String key = entry.getKey(); int pos = key.indexOf("Local"); test(pos == -1); } @@ -45,7 +45,7 @@ public class AllTests // // Get server's Slice checksums. // - java.util.Map d = checksum.getSliceChecksums(); + java.util.Map<String, String> d = checksum.getSliceChecksums(); // // Compare the checksums. For a type FooN whose name ends in an integer N, @@ -57,8 +57,8 @@ public class AllTests while(p.hasNext()) { int n = 0; - java.util.Map.Entry entry = (java.util.Map.Entry)p.next(); - String key = (String)entry.getKey(); + java.util.Map.Entry<String, String> entry = p.next(); + String key = entry.getKey(); java.util.regex.Matcher m = patt.matcher(key); if(m.find()) { diff --git a/java/test/Ice/checksum/client/build.xml b/java/test/Ice/checksum/client/build.xml index 355dd54e327..b7364c8cc52 100644 --- a/java/test/Ice/checksum/client/build.xml +++ b/java/test/Ice/checksum/client/build.xml @@ -31,13 +31,13 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" source="${jdk.version}" classpathref="ice.classpath" + <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" classpathref="ice.classpath" excludes="generated/**" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/checksum/server/ChecksumI.java b/java/test/Ice/checksum/server/ChecksumI.java index ed814db8934..4197a225702 100644 --- a/java/test/Ice/checksum/server/ChecksumI.java +++ b/java/test/Ice/checksum/server/ChecksumI.java @@ -15,7 +15,7 @@ public final class ChecksumI extends Test._ChecksumDisp _adapter = adapter; } - public java.util.Map + public java.util.Map<String, String> getSliceChecksums(Ice.Current __current) { return SliceChecksums.checksums; diff --git a/java/test/Ice/checksum/server/build.xml b/java/test/Ice/checksum/server/build.xml index 9d13436c2fb..f8417764116 100644 --- a/java/test/Ice/checksum/server/build.xml +++ b/java/test/Ice/checksum/server/build.xml @@ -31,13 +31,13 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> - <javac srcdir="${generated.dir}" destdir="${class.dir}" source="${jdk.version}" classpathref="ice.classpath" + <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" classpathref="ice.classpath" excludes="generated/**" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/custom/build.xml b/java/test/Ice/custom/build.xml index 5bd55e37e68..81861d95c47 100644 --- a/java/test/Ice/custom/build.xml +++ b/java/test/Ice/custom/build.xml @@ -39,20 +39,20 @@ <target name="compile4" depends="generate" if="java2"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"/> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + classpathref="ice.classpath" debug="${debug}"/> + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**,jdk1.5/**" debug="${debug}"/> </target> <target name="compile5" depends="generate" unless="java2"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**,jdk1.4/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/exceptions/build.xml b/java/test/Ice/exceptions/build.xml index 6a0ad6752e1..2079b368eb5 100644 --- a/java/test/Ice/exceptions/build.xml +++ b/java/test/Ice/exceptions/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/exceptionsAMD/build.xml b/java/test/Ice/exceptionsAMD/build.xml index 86519a9a969..eae0975c4c7 100644 --- a/java/test/Ice/exceptionsAMD/build.xml +++ b/java/test/Ice/exceptionsAMD/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/facets/AllTests.java b/java/test/Ice/facets/AllTests.java index 24fe827ee7a..8f7ac1ae49e 100644 --- a/java/test/Ice/facets/AllTests.java +++ b/java/test/Ice/facets/AllTests.java @@ -78,7 +78,7 @@ public class AllTests adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1"); adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2"); adapter.addFacet(obj3, communicator.stringToIdentity("id2"), ""); - java.util.Map fm = adapter.removeAllFacets(communicator.stringToIdentity("id1")); + java.util.Map<String, Ice.Object> fm = adapter.removeAllFacets(communicator.stringToIdentity("id1")); test(fm.size() == 2); test(fm.get("f1") == obj1); test(fm.get("f2") == obj2); diff --git a/java/test/Ice/facets/build.xml b/java/test/Ice/facets/build.xml index 308450f7dfc..8a71c17e579 100644 --- a/java/test/Ice/facets/build.xml +++ b/java/test/Ice/facets/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/faultTolerance/Client.java b/java/test/Ice/faultTolerance/Client.java index 4acdf7a54ea..a6f64994a4b 100644 --- a/java/test/Ice/faultTolerance/Client.java +++ b/java/test/Ice/faultTolerance/Client.java @@ -18,7 +18,7 @@ public class Client private static int run(String[] args, Ice.Communicator communicator) { - java.util.ArrayList ports = new java.util.ArrayList(args.length); + java.util.List<Integer> ports = new java.util.ArrayList<Integer>(args.length); for(int i = 0; i < args.length; i++) { if(args[i].charAt(0) == '-') @@ -43,7 +43,7 @@ public class Client ex.printStackTrace(); return 1; } - ports.add(new Integer(port)); + ports.add(port); } if(ports.isEmpty()) @@ -56,7 +56,7 @@ public class Client int[] arr = new int[ports.size()]; for(int i = 0; i < arr.length; i++) { - arr[i] = ((Integer)ports.get(i)).intValue(); + arr[i] = ports.get(i).intValue(); } try diff --git a/java/test/Ice/faultTolerance/build.xml b/java/test/Ice/faultTolerance/build.xml index 40025813a3d..db33c14c070 100644 --- a/java/test/Ice/faultTolerance/build.xml +++ b/java/test/Ice/faultTolerance/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/hold/build.xml b/java/test/Ice/hold/build.xml index caf429b29c6..e4fe3405e55 100644 --- a/java/test/Ice/hold/build.xml +++ b/java/test/Ice/hold/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/inheritance/build.xml b/java/test/Ice/inheritance/build.xml index c98e11a8c73..4d6ff79cdcc 100644 --- a/java/test/Ice/inheritance/build.xml +++ b/java/test/Ice/inheritance/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/interceptor/build.xml b/java/test/Ice/interceptor/build.xml index f1e71b3232c..b3a17492919 100644 --- a/java/test/Ice/interceptor/build.xml +++ b/java/test/Ice/interceptor/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/location/ServerLocatorRegistry.java b/java/test/Ice/location/ServerLocatorRegistry.java index a852965e111..a8c99fd02a2 100644 --- a/java/test/Ice/location/ServerLocatorRegistry.java +++ b/java/test/Ice/location/ServerLocatorRegistry.java @@ -42,7 +42,7 @@ public class ServerLocatorRegistry extends Test._TestLocatorRegistryDisp getAdapter(String adapter) throws Ice.AdapterNotFoundException { - Ice.ObjectPrx obj = (Ice.ObjectPrx)_adapters.get(adapter); + Ice.ObjectPrx obj = _adapters.get(adapter); if(obj == null) { throw new Ice.AdapterNotFoundException(); @@ -54,7 +54,7 @@ public class ServerLocatorRegistry extends Test._TestLocatorRegistryDisp getObject(Ice.Identity id) throws Ice.ObjectNotFoundException { - Ice.ObjectPrx obj = (Ice.ObjectPrx)_objects.get(id); + Ice.ObjectPrx obj = _objects.get(id); if(obj == null) { throw new Ice.ObjectNotFoundException(); @@ -62,6 +62,7 @@ public class ServerLocatorRegistry extends Test._TestLocatorRegistryDisp return obj; } - private java.util.HashMap _adapters = new java.util.HashMap(); - private java.util.HashMap _objects = new java.util.HashMap(); + private java.util.HashMap<String, Ice.ObjectPrx> _adapters = new java.util.HashMap<String, Ice.ObjectPrx>(); + private java.util.HashMap<Ice.Identity, Ice.ObjectPrx> _objects = + new java.util.HashMap<Ice.Identity, Ice.ObjectPrx>(); } diff --git a/java/test/Ice/location/ServerManagerI.java b/java/test/Ice/location/ServerManagerI.java index 3407472fdb8..d863de85876 100644 --- a/java/test/Ice/location/ServerManagerI.java +++ b/java/test/Ice/location/ServerManagerI.java @@ -15,7 +15,7 @@ public class ServerManagerI extends _ServerManagerDisp { _adapter = adapter; _registry = registry; - _communicators = new java.util.ArrayList(); + _communicators = new java.util.ArrayList<Ice.Communicator>(); _initData = initData; _initData.properties.setProperty("TestAdapter.Endpoints", "default"); @@ -28,10 +28,10 @@ public class ServerManagerI extends _ServerManagerDisp public void startServer(Ice.Current current) { - java.util.Iterator i = _communicators.iterator(); + java.util.Iterator<Ice.Communicator> i = _communicators.iterator(); while(i.hasNext()) { - Ice.Communicator c = (Ice.Communicator)i.next(); + Ice.Communicator c = i.next(); c.waitForShutdown(); c.destroy(); } @@ -67,16 +67,16 @@ public class ServerManagerI extends _ServerManagerDisp public void shutdown(Ice.Current current) { - java.util.Iterator i = _communicators.iterator(); + java.util.Iterator<Ice.Communicator> i = _communicators.iterator(); while(i.hasNext()) { - ((Ice.Communicator)i.next()).destroy(); + i.next().destroy(); } _adapter.getCommunicator().shutdown(); } private Ice.ObjectAdapter _adapter; private ServerLocatorRegistry _registry; - private java.util.ArrayList _communicators; + private java.util.List<Ice.Communicator> _communicators; private Ice.InitializationData _initData; } diff --git a/java/test/Ice/location/build.xml b/java/test/Ice/location/build.xml index 9aad9d80e98..8cf31c0fe39 100644 --- a/java/test/Ice/location/build.xml +++ b/java/test/Ice/location/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/objects/build.xml b/java/test/Ice/objects/build.xml index 1755ddc12ed..8a2080c3b67 100644 --- a/java/test/Ice/objects/build.xml +++ b/java/test/Ice/objects/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/operations/MyDerivedClassI.java b/java/test/Ice/operations/MyDerivedClassI.java index 4410d622a29..3f3da413448 100644 --- a/java/test/Ice/operations/MyDerivedClassI.java +++ b/java/test/Ice/operations/MyDerivedClassI.java @@ -81,13 +81,13 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return p1; } - public java.util.Map - opByteBoolD(java.util.Map p1, java.util.Map p2, + public java.util.Map<Byte, Boolean> + opByteBoolD(java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2, Test.ByteBoolDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<Byte, Boolean> r = new java.util.HashMap<Byte, Boolean>(); r.putAll(p1); r.putAll(p2); return r; @@ -174,13 +174,13 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return r; } - public java.util.Map - opLongFloatD(java.util.Map p1, java.util.Map p2, + public java.util.Map<Long, Float> + opLongFloatD(java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2, Test.LongFloatDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<Long, Float> r = new java.util.HashMap<Long, Float>(); r.putAll(p1); r.putAll(p2); return r; @@ -206,13 +206,13 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return Test.MyEnum.enum3; } - public java.util.Map - opShortIntD(java.util.Map p1, java.util.Map p2, + public java.util.Map<Short, Integer> + opShortIntD(java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2, Test.ShortIntDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<Short, Integer> r = new java.util.HashMap<Short, Integer>(); r.putAll(p1); r.putAll(p2); return r; @@ -272,13 +272,13 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return p1 + " " + p2; } - public java.util.Map - opStringMyEnumD(java.util.Map p1, java.util.Map p2, + public java.util.Map<String, Test.MyEnum> + opStringMyEnumD(java.util.Map<String, Test.MyEnum> p1, java.util.Map<String, Test.MyEnum> p2, Test.StringMyEnumDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> r = new java.util.HashMap<String, Test.MyEnum>(); r.putAll(p1); r.putAll(p2); return r; @@ -300,7 +300,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass { } - public java.util.Map + public java.util.Map<String, String> opContext(Ice.Current current) { return current.ctx; @@ -368,13 +368,13 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return r; } - public java.util.Map - opStringStringD(java.util.Map p1, java.util.Map p2, + public java.util.Map<String, String> + opStringStringD(java.util.Map<String, String> p1, java.util.Map<String, String> p2, Test.StringStringDHolder p3, Ice.Current current) { p3.value = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<String, String> r = new java.util.HashMap<String, String>(); r.putAll(p1); r.putAll(p2); return r; diff --git a/java/test/Ice/operations/Twoways.java b/java/test/Ice/operations/Twoways.java index 1e1864ba9a4..7e1343f6195 100644 --- a/java/test/Ice/operations/Twoways.java +++ b/java/test/Ice/operations/Twoways.java @@ -479,103 +479,103 @@ class Twoways } { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Byte((byte)10), Boolean.TRUE); - di1.put(new Byte((byte)100), Boolean.FALSE); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Byte((byte)10), Boolean.TRUE); - di2.put(new Byte((byte)11), Boolean.FALSE); - di2.put(new Byte((byte)101), Boolean.TRUE); + java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<Byte, Boolean>(); + di1.put((byte)10, Boolean.TRUE); + di1.put((byte)100, Boolean.FALSE); + java.util.Map<Byte, Boolean> di2 = new java.util.HashMap<Byte, Boolean>(); + di2.put((byte)10, Boolean.TRUE); + di2.put((byte)11, Boolean.FALSE); + di2.put((byte)101, Boolean.TRUE); Test.ByteBoolDHolder _do = new Test.ByteBoolDHolder(); - java.util.Map ro = p.opByteBoolD(di1, di2, _do); + java.util.Map<Byte, Boolean> ro = p.opByteBoolD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(((Boolean)ro.get(new Byte((byte)10))).booleanValue() == true); - test(((Boolean)ro.get(new Byte((byte)11))).booleanValue() == false); - test(((Boolean)ro.get(new Byte((byte)100))).booleanValue() == false); - test(((Boolean)ro.get(new Byte((byte)101))).booleanValue() == true); + test(ro.get((byte)10).booleanValue() == true); + test(ro.get((byte)11).booleanValue() == false); + test(ro.get((byte)100).booleanValue() == false); + test(ro.get((byte)101).booleanValue() == true); } { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Short((short)110), new Integer(-1)); - di1.put(new Short((short)1100), new Integer(123123)); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Short((short)110), new Integer(-1)); - di2.put(new Short((short)111), new Integer(-100)); - di2.put(new Short((short)1101), new Integer(0)); + java.util.Map<Short, Integer> di1 = new java.util.HashMap<Short, Integer>(); + di1.put((short)110, -1); + di1.put((short)1100, 123123); + java.util.Map<Short, Integer> di2 = new java.util.HashMap<Short, Integer>(); + di2.put((short)110, -1); + di2.put((short)111, -100); + di2.put((short)1101, 0); Test.ShortIntDHolder _do = new Test.ShortIntDHolder(); - java.util.Map ro = p.opShortIntD(di1, di2, _do); + java.util.Map<Short, Integer> ro = p.opShortIntD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(((Integer)ro.get(new Short((short)110))).intValue() == -1); - test(((Integer)ro.get(new Short((short)111))).intValue() == -100); - test(((Integer)ro.get(new Short((short)1100))).intValue() == 123123); - test(((Integer)ro.get(new Short((short)1101))).intValue() == 0); + test(ro.get((short)110).intValue() == -1); + test(ro.get((short)111).intValue() == -100); + test(ro.get((short)1100).intValue() == 123123); + test(ro.get((short)1101).intValue() == 0); } { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Long(999999110L), new Float(-1.1f)); - di1.put(new Long(999999111L), new Float(123123.2f)); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Long(999999110L), new Float(-1.1f)); - di2.put(new Long(999999120L), new Float(-100.4f)); - di2.put(new Long(999999130L), new Float(0.5f)); + java.util.Map<Long, Float> di1 = new java.util.HashMap<Long, Float>(); + di1.put(999999110L, new Float(-1.1f)); + di1.put(999999111L, new Float(123123.2f)); + java.util.Map<Long, Float> di2 = new java.util.HashMap<Long, Float>(); + di2.put(999999110L, new Float(-1.1f)); + di2.put(999999120L, new Float(-100.4f)); + di2.put(999999130L, new Float(0.5f)); Test.LongFloatDHolder _do = new Test.LongFloatDHolder(); - java.util.Map ro = p.opLongFloatD(di1, di2, _do); + java.util.Map<Long, Float> ro = p.opLongFloatD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(((Float)ro.get(new Long(999999110L))).floatValue() == -1.1f); - test(((Float)ro.get(new Long(999999120L))).floatValue() == -100.4f); - test(((Float)ro.get(new Long(999999111L))).floatValue() == 123123.2f); - test(((Float)ro.get(new Long(999999130L))).floatValue() == 0.5f); + test(ro.get(999999110L).floatValue() == -1.1f); + test(ro.get(999999120L).floatValue() == -100.4f); + test(ro.get(999999111L).floatValue() == 123123.2f); + test(ro.get(999999130L).floatValue() == 0.5f); } { - java.util.Map di1 = new java.util.HashMap(); + java.util.Map<String, String> di1 = new java.util.HashMap<String, String>(); di1.put("foo", "abc -1.1"); di1.put("bar", "abc 123123.2"); - java.util.Map di2 = new java.util.HashMap(); + java.util.Map<String, String> di2 = new java.util.HashMap<String, String>(); di2.put("foo", "abc -1.1"); di2.put("FOO", "abc -100.4"); di2.put("BAR", "abc 0.5"); Test.StringStringDHolder _do = new Test.StringStringDHolder(); - java.util.Map ro = p.opStringStringD(di1, di2, _do); + java.util.Map<String, String> ro = p.opStringStringD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(((String)ro.get("foo")).equals("abc -1.1")); - test(((String)ro.get("FOO")).equals("abc -100.4")); - test(((String)ro.get("bar")).equals("abc 123123.2")); - test(((String)ro.get("BAR")).equals("abc 0.5")); + test(ro.get("foo").equals("abc -1.1")); + test(ro.get("FOO").equals("abc -100.4")); + test(ro.get("bar").equals("abc 123123.2")); + test(ro.get("BAR").equals("abc 0.5")); } { - java.util.Map di1 = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> di1 = new java.util.HashMap<String, Test.MyEnum>(); di1.put("abc", Test.MyEnum.enum1); di1.put("", Test.MyEnum.enum2); - java.util.Map di2 = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> di2 = new java.util.HashMap<String, Test.MyEnum>(); di2.put("abc", Test.MyEnum.enum1); di2.put("qwerty", Test.MyEnum.enum3); di2.put("Hello!!", Test.MyEnum.enum2); Test.StringMyEnumDHolder _do = new Test.StringMyEnumDHolder(); - java.util.Map ro = p.opStringMyEnumD(di1, di2, _do); + java.util.Map<String, Test.MyEnum> ro = p.opStringMyEnumD(di1, di2, _do); test(_do.value.equals(di1)); test(ro.size() == 4); - test(((Test.MyEnum)ro.get("abc")) == Test.MyEnum.enum1); - test(((Test.MyEnum)ro.get("qwerty")) == Test.MyEnum.enum3); - test(((Test.MyEnum)ro.get("")) == Test.MyEnum.enum2); - test(((Test.MyEnum)ro.get("Hello!!")) == Test.MyEnum.enum2); + test(ro.get("abc") == Test.MyEnum.enum1); + test(ro.get("qwerty") == Test.MyEnum.enum3); + test(ro.get("") == Test.MyEnum.enum2); + test(ro.get("Hello!!") == Test.MyEnum.enum2); } { @@ -598,24 +598,24 @@ class Twoways } { - java.util.HashMap ctx = new java.util.HashMap(); + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); ctx.put("one", "ONE"); ctx.put("two", "TWO"); ctx.put("three", "THREE"); { test(p.ice_getContext().isEmpty()); - java.util.Map r = p.opContext(); + java.util.Map<String, String> r = p.opContext(); test(!r.equals(ctx)); } { - java.util.Map r = p.opContext(ctx); + java.util.Map<String, String> r = p.opContext(ctx); test(p.ice_getContext().isEmpty()); test(r.equals(ctx)); } { Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx)); test(p2.ice_getContext().equals(ctx)); - java.util.Map r = p2.opContext(); + java.util.Map<String, String> r = p2.opContext(); test(r.equals(ctx)); r = p2.opContext(ctx); test(r.equals(ctx)); @@ -669,53 +669,53 @@ class Twoways // // Test implicit context propagation // - + String[] impls = {"Shared", "PerThread"}; for(int i = 0; i < 2; i++) { Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - + Ice.Communicator ic = Ice.Util.initialize(initData); - - java.util.Map ctx = new java.util.HashMap(); + + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); ctx.put("one", "ONE"); ctx.put("two", "TWO"); ctx.put("three", "THREE"); - + Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( ic.stringToProxy("test:default -p 12010 -t 10000")); - + ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); test(p3.opContext().equals(ctx)); - + test(ic.getImplicitContext().containsKey("zero") == false); String r = ic.getImplicitContext().put("zero", "ZERO"); test(r.equals("")); test(ic.getImplicitContext().containsKey("zero") == true); test(ic.getImplicitContext().get("zero").equals("ZERO")); - + ctx = ic.getImplicitContext().getContext(); test(p3.opContext().equals(ctx)); - - java.util.Map prxContext = new java.util.HashMap(); + + java.util.Map<String, String> prxContext = new java.util.HashMap<String, String>(); prxContext.put("one", "UN"); prxContext.put("four", "QUATRE"); - - java.util.Map combined = new java.util.HashMap(ctx); + + java.util.Map<String, String> combined = new java.util.HashMap<String, String>(ctx); combined.putAll(prxContext); test(combined.get("one").equals("UN")); - + p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); - + ic.getImplicitContext().setContext(null); test(p3.opContext().equals(prxContext)); - + ic.getImplicitContext().setContext(ctx); test(p3.opContext().equals(combined)); - + test(ic.getImplicitContext().remove("one").equals("ONE")); ic.destroy(); diff --git a/java/test/Ice/operations/TwowaysAMI.java b/java/test/Ice/operations/TwowaysAMI.java index 29840d3f4af..0b3d430585f 100644 --- a/java/test/Ice/operations/TwowaysAMI.java +++ b/java/test/Ice/operations/TwowaysAMI.java @@ -48,7 +48,7 @@ class TwowaysAMI _called = false; return true; } - + public synchronized void called() { @@ -777,17 +777,17 @@ class TwowaysAMI private static class AMI_MyClass_opByteBoolDI extends Test.AMI_MyClass_opByteBoolD { public void - ice_response(java.util.Map ro, java.util.Map _do) + ice_response(java.util.Map<Byte, Boolean> ro, java.util.Map<Byte, Boolean> _do) { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Byte((byte)10), Boolean.TRUE); - di1.put(new Byte((byte)100), Boolean.FALSE); + java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<Byte, Boolean>(); + di1.put((byte)10, Boolean.TRUE); + di1.put((byte)100, Boolean.FALSE); test(_do.equals(di1)); test(ro.size() == 4); - test(((Boolean)ro.get(new Byte((byte)10))).booleanValue() == true); - test(((Boolean)ro.get(new Byte((byte)11))).booleanValue() == false); - test(((Boolean)ro.get(new Byte((byte)100))).booleanValue() == false); - test(((Boolean)ro.get(new Byte((byte)101))).booleanValue() == true); + test(ro.get((byte)10).booleanValue() == true); + test(ro.get((byte)11).booleanValue() == false); + test(ro.get((byte)100).booleanValue() == false); + test(ro.get((byte)101).booleanValue() == true); callback.called(); } @@ -809,17 +809,17 @@ class TwowaysAMI private static class AMI_MyClass_opShortIntDI extends Test.AMI_MyClass_opShortIntD { public void - ice_response(java.util.Map ro, java.util.Map _do) + ice_response(java.util.Map<Short, Integer> ro, java.util.Map<Short, Integer> _do) { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Short((short)110), new Integer(-1)); - di1.put(new Short((short)1100), new Integer(123123)); + java.util.Map<Short, Integer> di1 = new java.util.HashMap<Short, Integer>(); + di1.put((short)110, -1); + di1.put((short)1100, 123123); test(_do.equals(di1)); test(ro.size() == 4); - test(((Integer)ro.get(new Short((short)110))).intValue() == -1); - test(((Integer)ro.get(new Short((short)111))).intValue() == -100); - test(((Integer)ro.get(new Short((short)1100))).intValue() == 123123); - test(((Integer)ro.get(new Short((short)1101))).intValue() == 0); + test(ro.get((short)110).intValue() == -1); + test(ro.get((short)111).intValue() == -100); + test(ro.get((short)1100).intValue() == 123123); + test(ro.get((short)1101).intValue() == 0); callback.called(); } @@ -841,17 +841,17 @@ class TwowaysAMI private static class AMI_MyClass_opLongFloatDI extends Test.AMI_MyClass_opLongFloatD { public void - ice_response(java.util.Map ro, java.util.Map _do) + ice_response(java.util.Map<Long, Float> ro, java.util.Map<Long, Float> _do) { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Long(999999110L), new Float(-1.1f)); - di1.put(new Long(999999111L), new Float(123123.2f)); + java.util.Map<Long, Float> di1 = new java.util.HashMap<Long, Float>(); + di1.put(999999110L, new Float(-1.1f)); + di1.put(999999111L, new Float(123123.2f)); test(_do.equals(di1)); test(ro.size() == 4); - test(((Float)ro.get(new Long(999999110L))).floatValue() == -1.1f); - test(((Float)ro.get(new Long(999999120L))).floatValue() == -100.4f); - test(((Float)ro.get(new Long(999999111L))).floatValue() == 123123.2f); - test(((Float)ro.get(new Long(999999130L))).floatValue() == 0.5f); + test(ro.get(999999110L).floatValue() == -1.1f); + test(ro.get(999999120L).floatValue() == -100.4f); + test(ro.get(999999111L).floatValue() == 123123.2f); + test(ro.get(999999130L).floatValue() == 0.5f); callback.called(); } @@ -873,17 +873,17 @@ class TwowaysAMI private static class AMI_MyClass_opStringStringDI extends Test.AMI_MyClass_opStringStringD { public void - ice_response(java.util.Map ro, java.util.Map _do) + ice_response(java.util.Map<String, String> ro, java.util.Map<String, String> _do) { - java.util.Map di1 = new java.util.HashMap(); + java.util.Map<String, String> di1 = new java.util.HashMap<String, String>(); di1.put("foo", "abc -1.1"); di1.put("bar", "abc 123123.2"); test(_do.equals(di1)); test(ro.size() == 4); - test(((String)ro.get("foo")).equals("abc -1.1")); - test(((String)ro.get("FOO")).equals("abc -100.4")); - test(((String)ro.get("bar")).equals("abc 123123.2")); - test(((String)ro.get("BAR")).equals("abc 0.5")); + test(ro.get("foo").equals("abc -1.1")); + test(ro.get("FOO").equals("abc -100.4")); + test(ro.get("bar").equals("abc 123123.2")); + test(ro.get("BAR").equals("abc 0.5")); callback.called(); } @@ -905,17 +905,17 @@ class TwowaysAMI private static class AMI_MyClass_opStringMyEnumDI extends Test.AMI_MyClass_opStringMyEnumD { public void - ice_response(java.util.Map ro, java.util.Map _do) + ice_response(java.util.Map<String, Test.MyEnum> ro, java.util.Map<String, Test.MyEnum> _do) { - java.util.Map di1 = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> di1 = new java.util.HashMap<String, Test.MyEnum>(); di1.put("abc", Test.MyEnum.enum1); di1.put("", Test.MyEnum.enum2); test(_do.equals(di1)); test(ro.size() == 4); - test(((Test.MyEnum)ro.get("abc")) == Test.MyEnum.enum1); - test(((Test.MyEnum)ro.get("qwerty")) == Test.MyEnum.enum3); - test(((Test.MyEnum)ro.get("")) == Test.MyEnum.enum2); - test(((Test.MyEnum)ro.get("Hello!!")) == Test.MyEnum.enum2); + test(ro.get("abc") == Test.MyEnum.enum1); + test(ro.get("qwerty") == Test.MyEnum.enum3); + test(ro.get("") == Test.MyEnum.enum2); + test(ro.get("Hello!!") == Test.MyEnum.enum2); callback.called(); } @@ -970,13 +970,13 @@ class TwowaysAMI private static class AMI_MyClass_opContextEqualI extends Test.AMI_MyClass_opContext { - AMI_MyClass_opContextEqualI(java.util.Map d) + AMI_MyClass_opContextEqualI(java.util.Map<String, String> d) { _d = d; } public void - ice_response(java.util.Map r) + ice_response(java.util.Map<String, String> r) { test(r.equals(_d)); callback.called(); @@ -994,19 +994,19 @@ class TwowaysAMI return callback.check(); } - private java.util.Map _d; + private java.util.Map<String, String> _d; private Callback callback = new Callback(); } private static class AMI_MyClass_opContextNotEqualI extends Test.AMI_MyClass_opContext { - AMI_MyClass_opContextNotEqualI(java.util.Map d) + AMI_MyClass_opContextNotEqualI(java.util.Map<String, String> d) { _d = d; } public void - ice_response(java.util.Map r) + ice_response(java.util.Map<String, String> r) { test(!r.equals(_d)); callback.called(); @@ -1024,7 +1024,7 @@ class TwowaysAMI return callback.check(); } - private java.util.Map _d; + private java.util.Map<String, String> _d; private Callback callback = new Callback(); } @@ -1125,9 +1125,9 @@ class TwowaysAMI Ice.Communicator ic = Ice.Util.initialize(initData); Ice.ObjectPrx obj = ic.stringToProxy(p.ice_toString()); Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(obj); - + ic.destroy(); - + AMI_MyClass_opVoidI cb = new AMI_MyClass_opVoidI(); try { @@ -1152,13 +1152,13 @@ class TwowaysAMI p.opBool_async(cb, true, false); test(cb.check()); } - + { AMI_MyClass_opShortIntLongI cb = new AMI_MyClass_opShortIntLongI(); p.opShortIntLong_async(cb, (short)10, 11, 12L); test(cb.check()); } - + { AMI_MyClass_opFloatDoubleI cb = new AMI_MyClass_opFloatDoubleI(); p.opFloatDouble_async(cb, 3.14f, 1.1E10); @@ -1167,25 +1167,25 @@ class TwowaysAMI p.opFloatDouble_async(cb, 3.14f, 1.1E10); test(cb.check()); } - + { AMI_MyClass_opStringI cb = new AMI_MyClass_opStringI(); p.opString_async(cb, "hello", "world"); test(cb.check()); } - + { AMI_MyClass_opMyEnumI cb = new AMI_MyClass_opMyEnumI(); p.opMyEnum_async(cb, Test.MyEnum.enum2); test(cb.check()); } - + { AMI_MyClass_opMyClassI cb = new AMI_MyClass_opMyClassI(communicator); p.opMyClass_async(cb, p); test(cb.check()); } - + { Test.Structure si1 = new Test.Structure(); si1.p = p; @@ -1197,12 +1197,12 @@ class TwowaysAMI si2.e = Test.MyEnum.enum2; si2.s = new Test.AnotherStruct(); si2.s.s = "def"; - + AMI_MyClass_opStructI cb = new AMI_MyClass_opStructI(communicator); p.opStruct_async(cb, si1, si2); test(cb.check()); } - + { final byte[] bsi1 = { @@ -1218,49 +1218,49 @@ class TwowaysAMI (byte)0xf3, (byte)0xf4 }; - + AMI_MyClass_opByteSI cb = new AMI_MyClass_opByteSI(); p.opByteS_async(cb, bsi1, bsi2); test(cb.check()); } - + { final boolean[] bsi1 = { true, true, false }; final boolean[] bsi2 = { false }; - + AMI_MyClass_opBoolSI cb = new AMI_MyClass_opBoolSI(); p.opBoolS_async(cb, bsi1, bsi2); test(cb.check()); } - + { final short[] ssi = { 1, 2, 3 }; final int[] isi = { 5, 6, 7, 8 }; final long[] lsi = { 10, 30, 20 }; - + AMI_MyClass_opShortIntLongSI cb = new AMI_MyClass_opShortIntLongSI(); p.opShortIntLongS_async(cb, ssi, isi, lsi); test(cb.check()); } - + { final float[] fsi = { 3.14f, 1.11f }; final double[] dsi = { 1.1E10, 1.2E10, 1.3E10 }; - + AMI_MyClass_opFloatDoubleSI cb = new AMI_MyClass_opFloatDoubleSI(); p.opFloatDoubleS_async(cb, fsi, dsi); test(cb.check()); } - + { final String[] ssi1 = { "abc", "de", "fghi" }; final String[] ssi2 = { "xyz" }; - + AMI_MyClass_opStringSI cb = new AMI_MyClass_opStringSI(); p.opStringS_async(cb, ssi1, ssi2); test(cb.check()); } - + { final byte[][] bsi1 = { @@ -1356,13 +1356,13 @@ class TwowaysAMI } { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Byte((byte)10), Boolean.TRUE); - di1.put(new Byte((byte)100), Boolean.FALSE); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Byte((byte)10), Boolean.TRUE); - di2.put(new Byte((byte)11), Boolean.FALSE); - di2.put(new Byte((byte)101), Boolean.TRUE); + java.util.Map<Byte, Boolean> di1 = new java.util.HashMap<Byte, Boolean>(); + di1.put((byte)10, Boolean.TRUE); + di1.put((byte)100, Boolean.FALSE); + java.util.Map<Byte, Boolean> di2 = new java.util.HashMap<Byte, Boolean>(); + di2.put((byte)10, Boolean.TRUE); + di2.put((byte)11, Boolean.FALSE); + di2.put((byte)101, Boolean.TRUE); AMI_MyClass_opByteBoolDI cb = new AMI_MyClass_opByteBoolDI(); p.opByteBoolD_async(cb, di1, di2); @@ -1370,13 +1370,13 @@ class TwowaysAMI } { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Short((short)110), new Integer(-1)); - di1.put(new Short((short)1100), new Integer(123123)); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Short((short)110), new Integer(-1)); - di2.put(new Short((short)111), new Integer(-100)); - di2.put(new Short((short)1101), new Integer(0)); + java.util.Map<Short, Integer> di1 = new java.util.HashMap<Short, Integer>(); + di1.put((short)110, -1); + di1.put((short)1100, 123123); + java.util.Map<Short, Integer> di2 = new java.util.HashMap<Short, Integer>(); + di2.put((short)110, -1); + di2.put((short)111, -100); + di2.put((short)1101, 0); AMI_MyClass_opShortIntDI cb = new AMI_MyClass_opShortIntDI(); p.opShortIntD_async(cb, di1, di2); @@ -1384,13 +1384,13 @@ class TwowaysAMI } { - java.util.Map di1 = new java.util.HashMap(); - di1.put(new Long(999999110L), new Float(-1.1f)); - di1.put(new Long(999999111L), new Float(123123.2f)); - java.util.Map di2 = new java.util.HashMap(); - di2.put(new Long(999999110L), new Float(-1.1f)); - di2.put(new Long(999999120L), new Float(-100.4f)); - di2.put(new Long(999999130L), new Float(0.5f)); + java.util.Map<Long, Float> di1 = new java.util.HashMap<Long, Float>(); + di1.put(999999110L, new Float(-1.1f)); + di1.put(999999111L, new Float(123123.2f)); + java.util.Map<Long, Float> di2 = new java.util.HashMap<Long, Float>(); + di2.put(999999110L, new Float(-1.1f)); + di2.put(999999120L, new Float(-100.4f)); + di2.put(999999130L, new Float(0.5f)); AMI_MyClass_opLongFloatDI cb = new AMI_MyClass_opLongFloatDI(); p.opLongFloatD_async(cb, di1, di2); @@ -1398,10 +1398,10 @@ class TwowaysAMI } { - java.util.Map di1 = new java.util.HashMap(); + java.util.Map<String, String> di1 = new java.util.HashMap<String, String>(); di1.put("foo", "abc -1.1"); di1.put("bar", "abc 123123.2"); - java.util.Map di2 = new java.util.HashMap(); + java.util.Map<String, String> di2 = new java.util.HashMap<String, String>(); di2.put("foo", "abc -1.1"); di2.put("FOO", "abc -100.4"); di2.put("BAR", "abc 0.5"); @@ -1412,10 +1412,10 @@ class TwowaysAMI } { - java.util.Map di1 = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> di1 = new java.util.HashMap<String, Test.MyEnum>(); di1.put("abc", Test.MyEnum.enum1); di1.put("", Test.MyEnum.enum2); - java.util.Map di2 = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> di2 = new java.util.HashMap<String, Test.MyEnum>(); di2.put("abc", Test.MyEnum.enum1); di2.put("qwerty", Test.MyEnum.enum3); di2.put("Hello!!", Test.MyEnum.enum2); @@ -1442,7 +1442,7 @@ class TwowaysAMI } { - java.util.Map ctx = new java.util.HashMap(); + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); ctx.put("one", "ONE"); ctx.put("two", "TWO"); ctx.put("three", "THREE"); @@ -1476,7 +1476,7 @@ class TwowaysAMI // Test that default context is obtained correctly from communicator. // /* DEPRECATED - java.util.HashMap dflt = new java.util.HashMap(); + java.util.HashMap<String, String> dflt = new java.util.HashMap<String, String>(); dflt.put("a", "b"); communicator.setDefaultContext(dflt); { @@ -1485,9 +1485,10 @@ class TwowaysAMI test(cb.check()); } - p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap())); + p2 = Test.MyClassPrxHelper.uncheckedCast(p.ice_context(new java.util.HashMap<String, String>())); { - AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(new java.util.HashMap()); + AMI_MyClass_opContextEqualI cb = + new AMI_MyClass_opContextEqualI(new java.util.HashMap<String, String>()); p2.opContext_async(cb); test(cb.check()); } @@ -1501,7 +1502,8 @@ class TwowaysAMI communicator.setDefaultContext(new java.util.HashMap()); { - AMI_MyClass_opContextNotEqualI cb = new AMI_MyClass_opContextNotEqualI(new java.util.HashMap()); + AMI_MyClass_opContextNotEqualI cb = + new AMI_MyClass_opContextNotEqualI(new java.util.HashMap<String, String>()); p2.opContext_async(cb); test(cb.check()); } @@ -1510,7 +1512,7 @@ class TwowaysAMI Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast( communicator.stringToProxy("test:default -p 12010 -t 10000")); { - java.util.HashMap tmp = new java.util.HashMap(); + java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "b"); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); c.opContext_async(cb); @@ -1520,7 +1522,7 @@ class TwowaysAMI dflt.put("a", "c"); Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt)); { - java.util.HashMap tmp = new java.util.HashMap(); + java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "c"); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); c2.opContext_async(cb); @@ -1530,7 +1532,7 @@ class TwowaysAMI dflt.clear(); Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt)); { - java.util.HashMap tmp = new java.util.HashMap(); + java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); c3.opContext_async(cb); test(cb.check()); @@ -1538,7 +1540,7 @@ class TwowaysAMI Test.MyClassPrx c4 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); { - java.util.HashMap tmp = new java.util.HashMap(); + java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "b"); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); c4.opContext_async(cb); @@ -1550,14 +1552,14 @@ class TwowaysAMI Test.MyClassPrx c5 = Test.MyClassPrxHelper.uncheckedCast(c.ice_defaultContext()); { - java.util.HashMap tmp = new java.util.HashMap(); + java.util.HashMap<String, String> tmp = new java.util.HashMap<String, String>(); tmp.put("a", "d"); AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(tmp); c5.opContext_async(cb); test(cb.check()); } - communicator.setDefaultContext(new java.util.HashMap()); + communicator.setDefaultContext(new java.util.HashMap<String, String>()); */ } } @@ -1566,24 +1568,24 @@ class TwowaysAMI // // Test implicit context propagation // - + String[] impls = {"Shared", "PerThread"}; for(int i = 0; i < 2; i++) { Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = communicator.getProperties()._clone(); initData.properties.setProperty("Ice.ImplicitContext", impls[i]); - + Ice.Communicator ic = Ice.Util.initialize(initData); - - java.util.Map ctx = new java.util.HashMap(); + + java.util.Map<String, String> ctx = new java.util.HashMap<String, String>(); ctx.put("one", "ONE"); ctx.put("two", "TWO"); ctx.put("three", "THREE"); - + Test.MyClassPrx p3 = Test.MyClassPrxHelper.uncheckedCast( ic.stringToProxy("test:default -p 12010 -t 10000")); - + ic.getImplicitContext().setContext(ctx); test(ic.getImplicitContext().getContext().equals(ctx)); { @@ -1591,40 +1593,40 @@ class TwowaysAMI p3.opContext_async(cb); test(cb.check()); } - + ic.getImplicitContext().put("zero", "ZERO"); - + ctx = ic.getImplicitContext().getContext(); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(ctx); p3.opContext_async(cb); test(cb.check()); } - - java.util.Map prxContext = new java.util.HashMap(); + + java.util.Map<String, String> prxContext = new java.util.HashMap<String, String>(); prxContext.put("one", "UN"); prxContext.put("four", "QUATRE"); - - java.util.Map combined = new java.util.HashMap(ctx); + + java.util.Map<String, String> combined = new java.util.HashMap<String, String>(ctx); combined.putAll(prxContext); test(combined.get("one").equals("UN")); - + p3 = Test.MyClassPrxHelper.uncheckedCast(p3.ice_context(prxContext)); - + ic.getImplicitContext().setContext(null); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(prxContext); p3.opContext_async(cb); test(cb.check()); } - + ic.getImplicitContext().setContext(ctx); { AMI_MyClass_opContextEqualI cb = new AMI_MyClass_opContextEqualI(combined); p3.opContext_async(cb); test(cb.check()); } - + ic.destroy(); } } diff --git a/java/test/Ice/operations/build.xml b/java/test/Ice/operations/build.xml index 2cee72af775..cb8f398fb67 100644 --- a/java/test/Ice/operations/build.xml +++ b/java/test/Ice/operations/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/operationsAMD/MyDerivedClassI.java b/java/test/Ice/operationsAMD/MyDerivedClassI.java index 797b383c4b7..8bf90b58dec 100644 --- a/java/test/Ice/operationsAMD/MyDerivedClassI.java +++ b/java/test/Ice/operationsAMD/MyDerivedClassI.java @@ -127,11 +127,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opByteBoolD_async(Test.AMD_MyClass_opByteBoolD cb, - java.util.Map p1, java.util.Map p2, + java.util.Map<Byte, Boolean> p1, java.util.Map<Byte, Boolean> p2, Ice.Current current) { - java.util.Map p3 = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<Byte, Boolean> p3 = p1; + java.util.Map<Byte, Boolean> r = new java.util.HashMap<Byte, Boolean>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); @@ -218,11 +218,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opLongFloatD_async(Test.AMD_MyClass_opLongFloatD cb, - java.util.Map p1, java.util.Map p2, + java.util.Map<Long, Float> p1, java.util.Map<Long, Float> p2, Ice.Current current) { - java.util.Map p3 = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<Long, Float> p3 = p1; + java.util.Map<Long, Float> r = new java.util.HashMap<Long, Float>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); @@ -249,11 +249,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opShortIntD_async(Test.AMD_MyClass_opShortIntD cb, - java.util.Map p1, java.util.Map p2, + java.util.Map<Short, Integer> p1, java.util.Map<Short, Integer> p2, Ice.Current current) { - java.util.Map p3 = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<Short, Integer> p3 = p1; + java.util.Map<Short, Integer> r = new java.util.HashMap<Short, Integer>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); @@ -311,11 +311,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opStringMyEnumD_async(Test.AMD_MyClass_opStringMyEnumD cb, - java.util.Map p1, java.util.Map p2, + java.util.Map<String, Test.MyEnum> p1, java.util.Map<String, Test.MyEnum> p2, Ice.Current current) { - java.util.Map p3 = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<String, Test.MyEnum> p3 = p1; + java.util.Map<String, Test.MyEnum> r = new java.util.HashMap<String, Test.MyEnum>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); @@ -409,11 +409,11 @@ public final class MyDerivedClassI extends Test.MyDerivedClass public void opStringStringD_async(Test.AMD_MyClass_opStringStringD cb, - java.util.Map p1, java.util.Map p2, + java.util.Map<String, String> p1, java.util.Map<String, String> p2, Ice.Current current) { - java.util.Map p3 = p1; - java.util.Map r = new java.util.HashMap(); + java.util.Map<String, String> p3 = p1; + java.util.Map<String, String> r = new java.util.HashMap<String, String>(); r.putAll(p1); r.putAll(p2); cb.ice_response(r, p3); diff --git a/java/test/Ice/operationsAMD/build.xml b/java/test/Ice/operationsAMD/build.xml index 83f60fecba1..fa25ed867ad 100644 --- a/java/test/Ice/operationsAMD/build.xml +++ b/java/test/Ice/operationsAMD/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/package/build.xml b/java/test/Ice/package/build.xml index e234cd454c0..23c1f34a293 100644 --- a/java/test/Ice/package/build.xml +++ b/java/test/Ice/package/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/proxy/AllTests.java b/java/test/Ice/proxy/AllTests.java index 1f99253e451..62598767cd1 100644 --- a/java/test/Ice/proxy/AllTests.java +++ b/java/test/Ice/proxy/AllTests.java @@ -401,9 +401,9 @@ public class AllTests test(!compObj.ice_router(null).equals(compObj.ice_router(rtr2))); test(!compObj.ice_router(rtr1).equals(compObj.ice_router(rtr2))); - java.util.Map ctx1 = new java.util.HashMap(); + java.util.Map<String, String> ctx1 = new java.util.HashMap<String, String>(); ctx1.put("ctx1", "v1"); - java.util.Map ctx2 = new java.util.HashMap(); + java.util.Map<String, String> ctx2 = new java.util.HashMap<String, String>(); ctx2.put("ctx2", "v2"); test(compObj.ice_context(null).equals(compObj.ice_context(null))); test(compObj.ice_context(ctx1).equals(compObj.ice_context(ctx1))); @@ -451,14 +451,14 @@ public class AllTests System.out.print("testing checked cast with context... "); System.out.flush(); - java.util.Map c = cl.getContext(); + java.util.Map<String, String> c = cl.getContext(); test(c == null || c.size() == 0); - c = new java.util.HashMap(); + c = new java.util.HashMap<String, String>(); c.put("one", "hello"); c.put("two", "world"); cl = Test.MyClassPrxHelper.checkedCast(base, c); - java.util.Map c2 = cl.getContext(); + java.util.Map<String, String> c2 = cl.getContext(); test(c.equals(c2)); System.out.println("ok"); diff --git a/java/test/Ice/proxy/MyDerivedClassI.java b/java/test/Ice/proxy/MyDerivedClassI.java index 6abb2513be0..9a1f0eac2dc 100644 --- a/java/test/Ice/proxy/MyDerivedClassI.java +++ b/java/test/Ice/proxy/MyDerivedClassI.java @@ -26,7 +26,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass c.adapter.getCommunicator().shutdown(); } - public java.util.Map + public java.util.Map<String, String> getContext(Ice.Current current) { return _ctx; @@ -39,5 +39,5 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return super.ice_isA(s, current); } - private java.util.Map _ctx; + private java.util.Map<String, String> _ctx; } diff --git a/java/test/Ice/proxy/build.xml b/java/test/Ice/proxy/build.xml index 2cee72af775..cb8f398fb67 100644 --- a/java/test/Ice/proxy/build.xml +++ b/java/test/Ice/proxy/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/proxyAMD/MyDerivedClassI.java b/java/test/Ice/proxyAMD/MyDerivedClassI.java index ed26eb13dd1..17b8568ff75 100644 --- a/java/test/Ice/proxyAMD/MyDerivedClassI.java +++ b/java/test/Ice/proxyAMD/MyDerivedClassI.java @@ -43,5 +43,5 @@ public final class MyDerivedClassI extends Test.MyDerivedClass return super.ice_isA(s, current); } - private java.util.Map _ctx; + private java.util.Map<String, String> _ctx; } diff --git a/java/test/Ice/proxyAMD/build.xml b/java/test/Ice/proxyAMD/build.xml index 83f60fecba1..fa25ed867ad 100644 --- a/java/test/Ice/proxyAMD/build.xml +++ b/java/test/Ice/proxyAMD/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/retry/build.xml b/java/test/Ice/retry/build.xml index b50b2cb23de..207c7ab6e87 100644 --- a/java/test/Ice/retry/build.xml +++ b/java/test/Ice/retry/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/servantLocator/build.xml b/java/test/Ice/servantLocator/build.xml index ebdc205a676..a0c1c47cc43 100644 --- a/java/test/Ice/servantLocator/build.xml +++ b/java/test/Ice/servantLocator/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/servantLocatorAMD/build.xml b/java/test/Ice/servantLocatorAMD/build.xml index d51c19aa040..732ca966af4 100644 --- a/java/test/Ice/servantLocatorAMD/build.xml +++ b/java/test/Ice/servantLocatorAMD/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/slicing/exceptions/build.xml b/java/test/Ice/slicing/exceptions/build.xml index a121cc522de..94bcd591be3 100644 --- a/java/test/Ice/slicing/exceptions/build.xml +++ b/java/test/Ice/slicing/exceptions/build.xml @@ -55,21 +55,21 @@ <target name="compile" depends="generate"> <mkdir dir="${cclass.dir}"/> <javac srcdir="${cgen.dir}" destdir="${cclass.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="${csrc.dir}" destdir="${cclass.dir}" source="${jdk.version}" + <javac srcdir="${csrc.dir}" destdir="${cclass.dir}" classpathref="ice.classpath" excludes="${cgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> <mkdir dir="${sclass.dir}"/> <javac srcdir="${sgen.dir}" destdir="${sclass.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="${ssrc.dir}" destdir="${sclass.dir}" source="${jdk.version}" + <javac srcdir="${ssrc.dir}" destdir="${sclass.dir}" classpathref="ice.classpath" excludes="${sgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/slicing/exceptionsAMD/build.xml b/java/test/Ice/slicing/exceptionsAMD/build.xml index 0b9260152bd..76988d22f8a 100644 --- a/java/test/Ice/slicing/exceptionsAMD/build.xml +++ b/java/test/Ice/slicing/exceptionsAMD/build.xml @@ -33,12 +33,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/slicing/objects/build.xml b/java/test/Ice/slicing/objects/build.xml index a61c9900b5b..4a0ae963e61 100644 --- a/java/test/Ice/slicing/objects/build.xml +++ b/java/test/Ice/slicing/objects/build.xml @@ -61,21 +61,21 @@ <target name="compile" depends="generate"> <mkdir dir="${cclass.dir}"/> <javac srcdir="${cgen.dir}" destdir="${cclass.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="${csrc.dir}" destdir="${cclass.dir}" source="${jdk.version}" + <javac srcdir="${csrc.dir}" destdir="${cclass.dir}" classpathref="ice.classpath" excludes="${cgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> <mkdir dir="${sclass.dir}"/> <javac srcdir="${sgen.dir}" destdir="${sclass.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="${ssrc.dir}" destdir="${sclass.dir}" source="${jdk.version}" + <javac srcdir="${ssrc.dir}" destdir="${sclass.dir}" classpathref="ice.classpath" excludes="${sgen.dir}/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/slicing/objects/csrc/AllTests.java b/java/test/Ice/slicing/objects/csrc/AllTests.java index 3e3853b3f95..e47f68d1486 100644 --- a/java/test/Ice/slicing/objects/csrc/AllTests.java +++ b/java/test/Ice/slicing/objects/csrc/AllTests.java @@ -744,7 +744,7 @@ public class AllTests private static class AMI_Test_dictionaryTestI extends AMI_TestIntf_dictionaryTest { public void - ice_response(java.util.Map r, java.util.Map bout) + ice_response(java.util.Map<Integer, B> r, java.util.Map<Integer, B> bout) { this.r = r; this.bout = bout; @@ -771,8 +771,8 @@ public class AllTests private Callback callback = new Callback(); - public java.util.Map r; - public java.util.Map bout; + public java.util.Map<Integer, B> r; + public java.util.Map<Integer, B> bout; } private static class AMI_Test_throwBaseAsBaseI extends AMI_TestIntf_throwBaseAsBase @@ -2053,9 +2053,9 @@ public class AllTests { try { - java.util.IdentityHashMap bin = new java.util.IdentityHashMap(); + java.util.IdentityHashMap<Integer, B> bin = new java.util.IdentityHashMap<Integer, B>(); BDictHolder bout = new BDictHolder(); - java.util.Map r; + java.util.Map<Integer, B> r; int i; for(i = 0; i < 10; ++i) { @@ -2064,7 +2064,7 @@ public class AllTests d1.sb = s; d1.pb = d1; d1.sd1 = s; - bin.put(new Integer(i), d1); + bin.put(i, d1); } r = test.dictionaryTest(bin, bout); @@ -2072,7 +2072,7 @@ public class AllTests test(bout.value.size() == 10); for(i = 0; i < 10; ++i) { - B b = (B)bout.value.get(new Integer(i * 10)); + B b = bout.value.get(i * 10); test(b != null); String s = "D1." + new Integer(i).toString(); test(b.sb.equals(s)); @@ -2085,11 +2085,11 @@ public class AllTests test(r.size() == 10); for(i = 0; i < 10; ++i) { - B b = (B)r.get(new Integer(i * 20)); + B b = r.get(i * 20); test(b != null); String s = "D1." + new Integer(i * 20).toString(); test(b.sb.equals(s)); - test(b.pb == (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20)))); + test(b.pb == (i == 0 ? null : r.get((i - 1) * 20))); D1 d1 = (D1)b; test(d1 != null); test(d1.sd1.equals(s)); @@ -2106,9 +2106,9 @@ public class AllTests System.out.print("dictionary slicing (AMI)... "); System.out.flush(); { - java.util.Map bin = new java.util.HashMap(); - java.util.Map bout; - java.util.Map r; + java.util.Map<Integer, B> bin = new java.util.HashMap<Integer, B>(); + java.util.Map<Integer, B> bout; + java.util.Map<Integer, B> r; int i; for(i = 0; i < 10; ++i) { @@ -2117,7 +2117,7 @@ public class AllTests d1.sb = s; d1.pb = d1; d1.sd1 = s; - bin.put(new Integer(i), d1); + bin.put(i, d1); } AMI_Test_dictionaryTestI cb = new AMI_Test_dictionaryTestI(); @@ -2129,7 +2129,7 @@ public class AllTests test(bout.size() == 10); for(i = 0; i < 10; ++i) { - B b = (B)bout.get(new Integer(i * 10)); + B b = bout.get(i * 10); test(b != null); String s = "D1." + new Integer(i).toString(); test(b.sb.equals(s)); @@ -2142,11 +2142,11 @@ public class AllTests test(r.size() == 10); for(i = 0; i < 10; ++i) { - B b = (B)r.get(new Integer(i * 20)); + B b = r.get(i * 20); test(b != null); String s = "D1." + new Integer(i * 20).toString(); test(b.sb.equals(s)); - test(b.pb == (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20)))); + test(b.pb == (i == 0 ? null : r.get((i - 1) * 20))); D1 d1 = (D1)b; test(d1 != null); test(d1.sd1.equals(s)); diff --git a/java/test/Ice/slicing/objects/ssrc/TestI.java b/java/test/Ice/slicing/objects/ssrc/TestI.java index 4626253d3ba..ec190f5ca18 100644 --- a/java/test/Ice/slicing/objects/ssrc/TestI.java +++ b/java/test/Ice/slicing/objects/ssrc/TestI.java @@ -243,31 +243,31 @@ public final class TestI extends _TestIntfDisp return ss; } - public java.util.Map - dictionaryTest(java.util.Map bin, BDictHolder bout, Ice.Current current) + public java.util.Map<Integer, B> + dictionaryTest(java.util.Map<Integer, B> bin, BDictHolder bout, Ice.Current current) { - bout.value = new java.util.HashMap(); + bout.value = new java.util.HashMap<Integer, B>(); int i; for(i = 0; i < 10; ++i) { - B b = (B)bin.get(new Integer(i)); + B b = bin.get(i); D2 d2 = new D2(); d2.sb = b.sb; d2.pb = b.pb; d2.sd2 = "D2"; d2.pd2 = d2; - bout.value.put(new Integer(i * 10), d2); + bout.value.put(i * 10, d2); } - java.util.Map r = new java.util.HashMap(); + java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>(); for(i = 0; i < 10; ++i) { String s = "D1." + new Integer(i * 20).toString(); D1 d1 = new D1(); d1.sb = s; - d1.pb = (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20))); + d1.pb = (i == 0 ? null : r.get((i - 1) * 20)); d1.sd1 = s; d1.pd1 = d1; - r.put(new Integer(i * 20), d1); + r.put(i * 20, d1); } return r; } diff --git a/java/test/Ice/slicing/objectsAMD/TestI.java b/java/test/Ice/slicing/objectsAMD/TestI.java index e9137e3bc20..035f2ec6a44 100644 --- a/java/test/Ice/slicing/objectsAMD/TestI.java +++ b/java/test/Ice/slicing/objectsAMD/TestI.java @@ -266,30 +266,30 @@ public final class TestI extends _TestIntfDisp } public void - dictionaryTest_async(AMD_TestIntf_dictionaryTest cb, java.util.Map bin, Ice.Current current) + dictionaryTest_async(AMD_TestIntf_dictionaryTest cb, java.util.Map<Integer, B> bin, Ice.Current current) { - java.util.Map bout = new java.util.HashMap(); + java.util.Map<Integer, B> bout = new java.util.HashMap<Integer, B>(); int i; for(i = 0; i < 10; ++i) { - B b = (B)bin.get(new Integer(i)); + B b = bin.get(i); D2 d2 = new D2(); d2.sb = b.sb; d2.pb = b.pb; d2.sd2 = "D2"; d2.pd2 = d2; - bout.put(new Integer(i * 10), d2); + bout.put(i * 10, d2); } - java.util.Map r = new java.util.HashMap(); + java.util.Map<Integer, B> r = new java.util.HashMap<Integer, B>(); for(i = 0; i < 10; ++i) { String s = "D1." + new Integer(i * 20).toString(); D1 d1 = new D1(); d1.sb = s; - d1.pb = (i == 0 ? (B)null : (B)r.get(new Integer((i - 1) * 20))); + d1.pb = (i == 0 ? null : r.get((i - 1) * 20)); d1.sd1 = s; d1.pd1 = d1; - r.put(new Integer(i * 20), d1); + r.put(i * 20, d1); } cb.ice_response(r, bout); } diff --git a/java/test/Ice/slicing/objectsAMD/build.xml b/java/test/Ice/slicing/objectsAMD/build.xml index b0e4a9febad..1dde26a0af6 100644 --- a/java/test/Ice/slicing/objectsAMD/build.xml +++ b/java/test/Ice/slicing/objectsAMD/build.xml @@ -34,12 +34,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/stream/Client.java b/java/test/Ice/stream/Client.java index 0ae251fa00b..62b3374246c 100644 --- a/java/test/Ice/stream/Client.java +++ b/java/test/Ice/stream/Client.java @@ -434,7 +434,7 @@ public class Client arr[i].seq8 = new String[] { "string1", "string2", "string3", "string4" }; arr[i].seq9 = new Test.MyEnum[] { Test.MyEnum.enum3, Test.MyEnum.enum2, Test.MyEnum.enum1 }; arr[i].seq10 = new Test.MyClass[4]; // null elements. - arr[i].d = new java.util.HashMap(); + arr[i].d = new java.util.HashMap<String, Test.MyClass>(); arr[i].d.put("hi", arr[i]); } out = Ice.Util.createOutputStream(communicator); diff --git a/java/test/Ice/stream/build.xml b/java/test/Ice/stream/build.xml index 832b3f6b2e6..c98bcaa505b 100644 --- a/java/test/Ice/stream/build.xml +++ b/java/test/Ice/stream/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/threads/AllTests.java b/java/test/Ice/threads/AllTests.java index e8af45a5e33..0885c4f1306 100644 --- a/java/test/Ice/threads/AllTests.java +++ b/java/test/Ice/threads/AllTests.java @@ -279,8 +279,8 @@ public class AllTests System.out.flush(); { Test.AdapterPrx[] adapters = server.getAdapters(); - java.util.Set threadPerConnectionThreads = new java.util.HashSet(); - java.util.Set threadPoolThreads = new java.util.HashSet(); + java.util.Set<Integer> threadPerConnectionThreads = new java.util.HashSet<Integer>(); + java.util.Set<Integer> threadPoolThreads = new java.util.HashSet<Integer>(); for(int i = 0; i < adapters.length; ++i) { @@ -301,7 +301,7 @@ public class AllTests test(!cb.notified()); test(tid == cb.id()); // The thread id must be the same for both requests. test(!threadPerConnectionThreads.contains(new Integer(tid))); - threadPerConnectionThreads.add(new Integer(tid)); + threadPerConnectionThreads.add(tid); // // Closing the connection and creating a new one should start a new thread @@ -310,8 +310,8 @@ public class AllTests adapter.ice_getConnection().close(false); int tid2 = adapter.getThreadId(); test(tid != tid2); - test(!threadPerConnectionThreads.contains(new Integer(tid2))); - threadPerConnectionThreads.add(new Integer(tid2)); + test(!threadPerConnectionThreads.contains(tid2)); + threadPerConnectionThreads.add(tid2); } else { @@ -324,8 +324,8 @@ public class AllTests test(tid != cb.id()); // The thread ids must be different for the requests. test(!threadPoolThreads.contains(new Integer(tid))); threadPoolThreads.add(new Integer(tid)); - test(!threadPoolThreads.contains(new Integer(cb.id()))); - threadPoolThreads.add(new Integer(cb.id())); + test(!threadPoolThreads.contains(cb.id())); + threadPoolThreads.add(cb.id()); } } } diff --git a/java/test/Ice/threads/ThreadHookI.java b/java/test/Ice/threads/ThreadHookI.java index e055a513ecc..189f956d329 100644 --- a/java/test/Ice/threads/ThreadHookI.java +++ b/java/test/Ice/threads/ThreadHookI.java @@ -19,7 +19,7 @@ class ThreadHookI implements Ice.ThreadNotification { test(getThreadNumInternal() == -1); Thread t = Thread.currentThread(); - _threads.put(t, new Integer(_nextThreadId)); + _threads.put(t, _nextThreadId); _nextThreadId++; } @@ -47,7 +47,7 @@ class ThreadHookI implements Ice.ThreadNotification getThreadNumInternal() { Thread t = Thread.currentThread(); - Integer i = (Integer)_threads.get(t); + Integer i = _threads.get(t); if(i == null) { return -1; @@ -67,6 +67,6 @@ class ThreadHookI implements Ice.ThreadNotification } } - private java.util.Map _threads = new java.util.HashMap(); + private java.util.Map<Thread, Integer> _threads = new java.util.HashMap<Thread, Integer>(); private int _nextThreadId; } diff --git a/java/test/Ice/threads/build.xml b/java/test/Ice/threads/build.xml index 2cee72af775..cb8f398fb67 100644 --- a/java/test/Ice/threads/build.xml +++ b/java/test/Ice/threads/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/timeout/build.xml b/java/test/Ice/timeout/build.xml index 514e481e5db..78ca69759fe 100644 --- a/java/test/Ice/timeout/build.xml +++ b/java/test/Ice/timeout/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Ice/translator/build.xml b/java/test/Ice/translator/build.xml index b5d2b9fad35..2719cfbfefc 100644 --- a/java/test/Ice/translator/build.xml +++ b/java/test/Ice/translator/build.xml @@ -68,13 +68,13 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" classpathref="ice.classpath" excludes="generated/**" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="${generated.dir}" destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="${generated.dir}" destdir="${class.dir}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/IceBox/configuration/build.xml b/java/test/IceBox/configuration/build.xml index 05a34b619ad..644edb518b7 100644 --- a/java/test/IceBox/configuration/build.xml +++ b/java/test/IceBox/configuration/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/IceGrid/simple/build.xml b/java/test/IceGrid/simple/build.xml index 7c8773591c7..b1931936f20 100644 --- a/java/test/IceGrid/simple/build.xml +++ b/java/test/IceGrid/simple/build.xml @@ -29,12 +29,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/IceSSL/configuration/AllTests.java b/java/test/IceSSL/configuration/AllTests.java index aed291d2445..a900b6b604e 100644 --- a/java/test/IceSSL/configuration/AllTests.java +++ b/java/test/IceSSL/configuration/AllTests.java @@ -46,10 +46,10 @@ public class AllTests return result; } - private static java.util.Map + private static java.util.Map<String, String> createServerProps(Ice.Properties defaultProperties, String defaultDir, String defaultHost) { - java.util.Map result = new java.util.HashMap(); + java.util.Map<String, String> result = new java.util.HashMap<String, String>(); result.put("Ice.Plugin.IceSSL", "IceSSL.PluginFactory"); if(defaultProperties.getPropertyAsInt("Ice.ThreadPerConnection") > 0) { @@ -114,7 +114,7 @@ public class AllTests Ice.ObjectPrx obj = comm.stringToProxy(factoryRef); test(obj != null); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(obj); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); d.put("IceSSL.VerifyPeer", "0"); Test.ServerPrx server = fact.createServer(d); @@ -143,7 +143,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -452,7 +452,7 @@ public class AllTests Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); d.put("IceSSL.VerifyPeer", "0"); Test.ServerPrx server = fact.createServer(d); @@ -512,7 +512,7 @@ public class AllTests Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -563,7 +563,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -629,7 +629,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1_exp.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -698,7 +698,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca2.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacerts.jks"); @@ -822,7 +822,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -853,7 +853,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -943,7 +943,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -982,7 +982,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Alias", "rsacert"); d.put("IceSSL.Password", "password"); @@ -1024,7 +1024,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1049,7 +1049,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1077,7 +1077,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1102,7 +1102,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1129,7 +1129,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1154,7 +1154,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1181,7 +1181,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1207,7 +1207,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1234,7 +1234,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.TrustOnly", "C=US, ST=Florida, O=ZeroC\\, Inc.,OU=Ice, emailAddress=info@zeroc.com, CN=Client"); d.put("IceSSL.Ciphers", "NONE (.*DH_anon.*)"); @@ -1266,7 +1266,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1295,7 +1295,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1327,7 +1327,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1354,7 +1354,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1384,7 +1384,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); @@ -1412,7 +1412,7 @@ public class AllTests Ice.Communicator comm = Ice.Util.initialize(args, initData); Test.ServerFactoryPrx fact = Test.ServerFactoryPrxHelper.checkedCast(comm.stringToProxy(factoryRef)); test(fact != null); - java.util.Map d = createServerProps(defaultProperties, defaultDir, defaultHost); + java.util.Map<String, String> d = createServerProps(defaultProperties, defaultDir, defaultHost); d.put("IceSSL.Keystore", "s_rsa_dsa_ca1.jks"); d.put("IceSSL.Password", "password"); d.put("IceSSL.Truststore", "cacert1.jks"); diff --git a/java/test/IceSSL/configuration/CertificateVerifierI.java b/java/test/IceSSL/configuration/CertificateVerifierI.java index aa598e8d0bf..f1c0c440d13 100644 --- a/java/test/IceSSL/configuration/CertificateVerifierI.java +++ b/java/test/IceSSL/configuration/CertificateVerifierI.java @@ -22,15 +22,15 @@ public class CertificateVerifierI implements IceSSL.CertificateVerifier { try { - java.util.Collection subjectAltNames = + java.util.Collection<java.util.List<?> > subjectAltNames = ((java.security.cert.X509Certificate)info.certs[0]).getSubjectAlternativeNames(); test(subjectAltNames != null); - java.util.ArrayList ipAddresses = new java.util.ArrayList(); - java.util.ArrayList dnsNames = new java.util.ArrayList(); - java.util.Iterator i = subjectAltNames.iterator(); + java.util.List<String> ipAddresses = new java.util.ArrayList<String>(); + java.util.List<String> dnsNames = new java.util.ArrayList<String>(); + java.util.Iterator<java.util.List<?> > i = subjectAltNames.iterator(); while(i.hasNext()) { - java.util.List l = (java.util.List)i.next(); + java.util.List<?> l = i.next(); test(!l.isEmpty()); Integer n = (Integer)l.get(0); if(n.intValue() == 7) diff --git a/java/test/IceSSL/configuration/ServerFactoryI.java b/java/test/IceSSL/configuration/ServerFactoryI.java index 5889c1851b2..16de42d825a 100644 --- a/java/test/IceSSL/configuration/ServerFactoryI.java +++ b/java/test/IceSSL/configuration/ServerFactoryI.java @@ -19,15 +19,15 @@ class ServerFactoryI extends Test._ServerFactoryDisp } public Test.ServerPrx - createServer(java.util.Map props, Ice.Current current) + createServer(java.util.Map<String, String> props, Ice.Current current) { Ice.InitializationData initData = new Ice.InitializationData(); initData.properties = Ice.Util.createProperties(); - java.util.Iterator i = props.entrySet().iterator(); + java.util.Iterator<java.util.Map.Entry<String, String> > i = props.entrySet().iterator(); while(i.hasNext()) { - java.util.Map.Entry e = (java.util.Map.Entry)i.next(); - initData.properties.setProperty((String)e.getKey(), (String)e.getValue()); + java.util.Map.Entry<String, String> e = i.next(); + initData.properties.setProperty(e.getKey(), e.getValue()); } String[] args = new String[0]; @@ -47,7 +47,7 @@ class ServerFactoryI extends Test._ServerFactoryDisp Ice.Identity key = srv.ice_getIdentity(); if(_servers.containsKey(key)) { - ServerI server = (ServerI)_servers.get(key); + ServerI server = _servers.get(key); server.destroy(); _servers.remove(key); } @@ -60,5 +60,5 @@ class ServerFactoryI extends Test._ServerFactoryDisp current.adapter.getCommunicator().shutdown(); } - private java.util.HashMap _servers = new java.util.HashMap(); + private java.util.Map<Ice.Identity, ServerI> _servers = new java.util.HashMap<Ice.Identity, ServerI>(); } diff --git a/java/test/IceSSL/configuration/build.xml b/java/test/IceSSL/configuration/build.xml index bf9854188ce..9a50b720f2c 100644 --- a/java/test/IceSSL/configuration/build.xml +++ b/java/test/IceSSL/configuration/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/IceUtil/inputUtil/build.xml b/java/test/IceUtil/inputUtil/build.xml index 2cee72af775..cb8f398fb67 100644 --- a/java/test/IceUtil/inputUtil/build.xml +++ b/java/test/IceUtil/inputUtil/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> diff --git a/java/test/Slice/keyword/build.xml b/java/test/Slice/keyword/build.xml index b363708481b..f403b76ae59 100644 --- a/java/test/Slice/keyword/build.xml +++ b/java/test/Slice/keyword/build.xml @@ -32,12 +32,12 @@ <target name="compile" depends="generate"> <mkdir dir="${class.dir}"/> <javac srcdir="${generated.dir}" destdir="${class.dir}" - source="${jdk.version}" classpathref="ice.classpath" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + classpathref="ice.classpath" debug="${debug}"> + <compilerarg value="${javac.lint}"/> </javac> - <javac srcdir="." destdir="${class.dir}" source="${jdk.version}" + <javac srcdir="." destdir="${class.dir}" classpathref="ice.classpath" excludes="generated/**" debug="${debug}"> - <compilerarg value="${javac.lint}" compiler="${javac.lint.compiler}"/> + <compilerarg value="${javac.lint}"/> </javac> </target> |