Fix HashMap => AbstractMap conversions in Java test thrift code
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664955 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/java/src/TestClient.java b/test/java/src/TestClient.java
index 7e2e49e..bc95036 100644
--- a/test/java/src/TestClient.java
+++ b/test/java/src/TestClient.java
@@ -10,6 +10,7 @@
import com.facebook.thrift.transport.TTransportException;
import com.facebook.thrift.protocol.TBinaryProtocol;
+import java.util.AbstractMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.ArrayList;
@@ -176,7 +177,7 @@
System.out.print(key + " => " + mapout.get(key));
}
System.out.print("})");
- HashMap<Integer,Integer> mapin = testClient.testMap(mapout);
+ AbstractMap<Integer,Integer> mapin = testClient.testMap(mapout);
System.out.print(" = {");
first = true;
for (int key : mapin.keySet()) {
@@ -285,12 +286,12 @@
* NESTED MAP TEST
*/
System.out.print("testMapMap(1)");
- HashMap<Integer,HashMap<Integer,Integer>> mm =
+ AbstractMap<Integer,AbstractMap<Integer,Integer>> mm =
testClient.testMapMap(1);
System.out.print(" = {");
for (int key : mm.keySet()) {
System.out.print(key + " => {");
- HashMap<Integer,Integer> m2 = mm.get(key);
+ AbstractMap<Integer,Integer> m2 = mm.get(key);
for (int k2 : m2.keySet()) {
System.out.print(k2 + " => " + m2.get(k2) + ", ");
}
@@ -310,17 +311,17 @@
truck.i64_thing = 8;
insane.xtructs.add(truck);
System.out.print("testInsanity()");
- HashMap<Long,HashMap<Integer,Insanity>> whoa =
+ AbstractMap<Long,AbstractMap<Integer,Insanity>> whoa =
testClient.testInsanity(insane);
System.out.print(" = {");
for (long key : whoa.keySet()) {
- HashMap<Integer,Insanity> val = whoa.get(key);
+ AbstractMap<Integer,Insanity> val = whoa.get(key);
System.out.print(key + " => {");
for (int k2 : val.keySet()) {
Insanity v2 = val.get(k2);
System.out.print(k2 + " => {");
- HashMap<Integer, Long> userMap = v2.userMap;
+ AbstractMap<Integer, Long> userMap = v2.userMap;
System.out.print("{");
for (int k3 : userMap.keySet()) {
System.out.print(k3 + " => " + userMap.get(k3) + ", ");
diff --git a/test/java/src/TestServer.java b/test/java/src/TestServer.java
index bf3f685..d89ea21 100644
--- a/test/java/src/TestServer.java
+++ b/test/java/src/TestServer.java
@@ -14,6 +14,7 @@
import java.net.ServerSocket;
import java.util.ArrayList;
+import java.util.AbstractMap;
import java.util.HashMap;
import java.util.HashSet;
@@ -73,7 +74,7 @@
return nest;
}
- public HashMap<Integer,Integer> testMap(HashMap<Integer,Integer> thing) {
+ public AbstractMap<Integer,Integer> testMap(AbstractMap<Integer,Integer> thing) {
System.out.print("testMap({");
boolean first = true;
for (int key : thing.keySet()) {
@@ -128,10 +129,10 @@
return thing;
}
- public HashMap<Integer,HashMap<Integer,Integer>> testMapMap(int hello) {
+ public AbstractMap<Integer,AbstractMap<Integer,Integer>> testMapMap(int hello) {
System.out.print("testMapMap(" + hello + ")\n");
- HashMap<Integer,HashMap<Integer,Integer>> mapmap =
- new HashMap<Integer,HashMap<Integer,Integer>>();
+ AbstractMap<Integer,AbstractMap<Integer,Integer>> mapmap =
+ new HashMap<Integer,AbstractMap<Integer,Integer>>();
HashMap<Integer,Integer> pos = new HashMap<Integer,Integer>();
HashMap<Integer,Integer> neg = new HashMap<Integer,Integer>();
@@ -146,7 +147,7 @@
return mapmap;
}
- public HashMap<Long, HashMap<Integer,Insanity>> testInsanity(Insanity argument) {
+ public AbstractMap<Long, AbstractMap<Integer,Insanity>> testInsanity(Insanity argument) {
System.out.print("testInsanity()\n");
Xtruct hello = new Xtruct();
@@ -177,15 +178,15 @@
second_map.put(Numberz.SIX, looney);
- HashMap<Long,HashMap<Integer,Insanity>> insane =
- new HashMap<Long, HashMap<Integer,Insanity>>();
+ AbstractMap<Long,AbstractMap<Integer,Insanity>> insane =
+ new HashMap<Long, AbstractMap<Integer,Insanity>>();
insane.put((long)1, first_map);
insane.put((long)2, second_map);
return insane;
}
- public Xtruct testMulti(byte arg0, int arg1, long arg2, HashMap<Short,String> arg3, int arg4, long arg5) {
+ public Xtruct testMulti(byte arg0, int arg1, long arg2, AbstractMap<Short,String> arg3, int arg4, long arg5) {
System.out.print("testMulti()\n");
Xtruct hello = new Xtruct();;