THRIFT-366. java: Lots of little warnings in java library

This cleans up imports, adds generic arguments where necessary, and puts OverloadNonblockingServer into the right package. 



git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@753072 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/src/org/apache/thrift/meta_data/FieldMetaData.java b/lib/java/src/org/apache/thrift/meta_data/FieldMetaData.java
index efb7630..95c2b48 100644
--- a/lib/java/src/org/apache/thrift/meta_data/FieldMetaData.java
+++ b/lib/java/src/org/apache/thrift/meta_data/FieldMetaData.java
@@ -13,10 +13,10 @@
   public final String fieldName;
   public final byte requirementType;
   public final FieldValueMetaData valueMetaData;
-  private static Map<Class<? extends TBase>, Map> structMap;
+  private static Map<Class<? extends TBase>, Map<Integer, FieldMetaData>> structMap;
   
   static {
-    structMap = new HashMap<Class<? extends TBase>, Map>();
+    structMap = new HashMap<Class<? extends TBase>, Map<Integer, FieldMetaData>>();
   }
   
   public FieldMetaData(String name, byte req, FieldValueMetaData vMetaData){
@@ -25,7 +25,7 @@
     this.valueMetaData = vMetaData;
   }
   
-  public static void addStructMetaDataMap(Class<? extends TBase> sClass, Map map){
+  public static void addStructMetaDataMap(Class<? extends TBase> sClass, Map<Integer, FieldMetaData> map){
     structMap.put(sClass, map);
   }
 
diff --git a/lib/java/src/org/apache/thrift/meta_data/StructMetaData.java b/lib/java/src/org/apache/thrift/meta_data/StructMetaData.java
index 8fd6ce0..1d11931 100644
--- a/lib/java/src/org/apache/thrift/meta_data/StructMetaData.java
+++ b/lib/java/src/org/apache/thrift/meta_data/StructMetaData.java
@@ -1,9 +1,11 @@
 package org.apache.thrift.meta_data;
 
+import org.apache.thrift.TBase;
+
 public class StructMetaData extends FieldValueMetaData {
-  public final Class structClass;
+  public final Class<? extends TBase> structClass;
   
-  public StructMetaData(byte type, Class sClass){
+  public StructMetaData(byte type, Class<? extends TBase> sClass){
     super(type);
     this.structClass = sClass;
   }    
diff --git a/lib/java/src/org/apache/thrift/server/THsHaServer.java b/lib/java/src/org/apache/thrift/server/THsHaServer.java
index ccb4a8e..cdca923 100644
--- a/lib/java/src/org/apache/thrift/server/THsHaServer.java
+++ b/lib/java/src/org/apache/thrift/server/THsHaServer.java
@@ -1,27 +1,17 @@
 
 package org.apache.thrift.server;
 
-import org.apache.thrift.TException;
-import org.apache.thrift.TProcessor;
-import org.apache.thrift.TProcessorFactory;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.transport.TNonblockingServerTransport;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TNonblockingTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.apache.thrift.transport.TTransportFactory;
-
 import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
-import java.io.IOException;
+import org.apache.thrift.TProcessor;
+import org.apache.thrift.TProcessorFactory;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TNonblockingServerTransport;
 
 /**
  * An extension of the TNonblockingServer to a Half-Sync/Half-Async server.
diff --git a/lib/java/src/org/apache/thrift/server/TNonblockingServer.java b/lib/java/src/org/apache/thrift/server/TNonblockingServer.java
index 2185980..e5f49df 100644
--- a/lib/java/src/org/apache/thrift/server/TNonblockingServer.java
+++ b/lib/java/src/org/apache/thrift/server/TNonblockingServer.java
@@ -1,44 +1,31 @@
 
 package org.apache.thrift.server;
 
-import org.apache.thrift.TException;
-import org.apache.thrift.TProcessor;
-import org.apache.thrift.TProcessorFactory;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.transport.TNonblockingServerTransport;
-import org.apache.thrift.transport.TIOStreamTransport;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TNonblockingTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.apache.thrift.transport.TTransportFactory;
-import org.apache.thrift.TByteArrayOutputStream;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.Iterator;
-import java.util.HashMap;
-import java.util.Set;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.spi.SelectorProvider;
 import java.util.HashSet;
-
+import java.util.Iterator;
+import java.util.Set;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import java.io.IOException;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.nio.ByteBuffer;
-import java.nio.channels.Selector;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.spi.SelectorProvider;
-import java.nio.channels.CancelledKeyException;
-import java.nio.channels.ClosedChannelException;
+import org.apache.thrift.TByteArrayOutputStream;
+import org.apache.thrift.TException;
+import org.apache.thrift.TProcessor;
+import org.apache.thrift.TProcessorFactory;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TIOStreamTransport;
+import org.apache.thrift.transport.TNonblockingServerTransport;
+import org.apache.thrift.transport.TNonblockingTransport;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
 
 /**
  * A nonblocking TServer implementation. This allows for fairness amongst all
diff --git a/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java b/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
index 9e1af69..b03f80e 100644
--- a/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
+++ b/lib/java/src/org/apache/thrift/transport/TNonblockingServerSocket.java
@@ -4,14 +4,12 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
-import java.net.Socket;
 import java.net.SocketException;
-
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
 import java.nio.channels.ServerSocketChannel;
 import java.nio.channels.SocketChannel;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.ClosedChannelException;
 
 /**
  * Wrapper around ServerSocketChannel
diff --git a/lib/java/src/org/apache/thrift/transport/TNonblockingSocket.java b/lib/java/src/org/apache/thrift/transport/TNonblockingSocket.java
index b14b84b..7f408dc 100644
--- a/lib/java/src/org/apache/thrift/transport/TNonblockingSocket.java
+++ b/lib/java/src/org/apache/thrift/transport/TNonblockingSocket.java
@@ -1,17 +1,13 @@
 
 package org.apache.thrift.transport;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
 import java.io.IOException;
-import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketException;
-
 import java.nio.ByteBuffer;
-import java.nio.channels.SocketChannel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.Selector;
+import java.nio.channels.SocketChannel;
 
 /**
  * Socket implementation of the TTransport interface. To be commented soon!
diff --git a/lib/java/test/org/apache/thrift/test/IdentityTest.java b/lib/java/test/org/apache/thrift/test/IdentityTest.java
index afc114a..584bf14 100644
--- a/lib/java/test/org/apache/thrift/test/IdentityTest.java
+++ b/lib/java/test/org/apache/thrift/test/IdentityTest.java
@@ -1,24 +1,23 @@
 package org.apache.thrift.test;
 
 // Generated code
-import thrift.test.*;
-
-import org.apache.thrift.TSerializer;
-import org.apache.thrift.TDeserializer;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TSimpleJSONProtocol;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ArrayList;
-
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+import org.apache.thrift.TDeserializer;
+import org.apache.thrift.TSerializer;
+import org.apache.thrift.protocol.TBinaryProtocol;
+
+import thrift.test.Bonk;
+import thrift.test.HolyMoley;
+import thrift.test.Nesting;
+import thrift.test.OneOfEach;
 
 /**
  *
diff --git a/lib/java/test/org/apache/thrift/test/JSONProtoTest.java b/lib/java/test/org/apache/thrift/test/JSONProtoTest.java
index 4dba33f..c955bc0 100644
--- a/lib/java/test/org/apache/thrift/test/JSONProtoTest.java
+++ b/lib/java/test/org/apache/thrift/test/JSONProtoTest.java
@@ -1,17 +1,19 @@
 package org.apache.thrift.test;
 
 // Generated code
-import thrift.test.*;
-
-import org.apache.thrift.transport.TMemoryBuffer;
-import org.apache.thrift.protocol.TJSONProtocol;
-
-import java.util.Map;
+import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Set;
 import java.util.HashSet;
 import java.util.List;
-import java.util.ArrayList;
+
+import org.apache.thrift.protocol.TJSONProtocol;
+import org.apache.thrift.transport.TMemoryBuffer;
+
+import thrift.test.Base64;
+import thrift.test.Bonk;
+import thrift.test.HolyMoley;
+import thrift.test.Nesting;
+import thrift.test.OneOfEach;
 
 /**
  * Tests for the Java implementation of TJSONProtocol. Mirrors the C++ version
diff --git a/lib/java/test/org/apache/thrift/test/JavaBeansTest.java b/lib/java/test/org/apache/thrift/test/JavaBeansTest.java
index 707a4c2..ec88029 100644
--- a/lib/java/test/org/apache/thrift/test/JavaBeansTest.java
+++ b/lib/java/test/org/apache/thrift/test/JavaBeansTest.java
@@ -40,10 +40,10 @@
     // Everything is set
     ooe.set_a_bite((byte) 1);
     ooe.set_base64("bytes".getBytes());
-    ooe.set_byte_list(new LinkedList());
+    ooe.set_byte_list(new LinkedList<Byte>());
     ooe.set_double_precision(1);
-    ooe.set_i16_list(new LinkedList());
-    ooe.set_i64_list(new LinkedList());
+    ooe.set_i16_list(new LinkedList<Short>());
+    ooe.set_i64_list(new LinkedList<Long>());
     ooe.set_boolean_field(true);
     ooe.set_integer16((short) 1);
     ooe.set_integer32(1);
diff --git a/lib/java/test/org/apache/thrift/test/MetaDataTest.java b/lib/java/test/org/apache/thrift/test/MetaDataTest.java
index daf9b44..f1369db 100644
--- a/lib/java/test/org/apache/thrift/test/MetaDataTest.java
+++ b/lib/java/test/org/apache/thrift/test/MetaDataTest.java
@@ -14,9 +14,7 @@
 public class MetaDataTest {
   
   public static void main(String[] args) throws Exception {
-    CrazyNesting cn = new CrazyNesting();
-    Insanity in = new Insanity();
-    Map<Integer, FieldMetaData> mdMap = cn.metaDataMap;
+    Map<Integer, FieldMetaData> mdMap = CrazyNesting.metaDataMap;
     
     // Check for struct fields existence
     if (mdMap.size() != 3)
@@ -53,8 +51,8 @@
             FieldMetaData.getStructMetaDataMap(Insanity.class) == null ||
             FieldMetaData.getStructMetaDataMap(Xtruct.class) == null)
       throw new RuntimeException("global metadata map doesn't contain an entry for a known struct");
-    if (FieldMetaData.getStructMetaDataMap(CrazyNesting.class) != cn.metaDataMap ||
-            FieldMetaData.getStructMetaDataMap(Insanity.class) != in.metaDataMap)
+    if (FieldMetaData.getStructMetaDataMap(CrazyNesting.class) != CrazyNesting.metaDataMap ||
+            FieldMetaData.getStructMetaDataMap(Insanity.class) != Insanity.metaDataMap)
       throw new RuntimeException("global metadata map contains wrong entry for a loaded struct");    
   }
 }
diff --git a/lib/java/test/org/apache/thrift/test/OverloadNonblockingServer.java b/lib/java/test/org/apache/thrift/test/OverloadNonblockingServer.java
index 49b7509..809d532 100644
--- a/lib/java/test/org/apache/thrift/test/OverloadNonblockingServer.java
+++ b/lib/java/test/org/apache/thrift/test/OverloadNonblockingServer.java
@@ -1,23 +1,8 @@
 
-package org.apache.thrift;
+package org.apache.thrift.test;
 
-import thrift.test.*;
-
-import org.apache.thrift.TApplicationException;
-import org.apache.thrift.TSerializer;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TTransportException;
 import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TSimpleJSONProtocol;
-
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ArrayList;
+import org.apache.thrift.transport.TSocket;
 
 
 public class OverloadNonblockingServer {
diff --git a/lib/java/test/org/apache/thrift/test/TCompactProtocolTest.java b/lib/java/test/org/apache/thrift/test/TCompactProtocolTest.java
index b8df71d..88a55e2 100755
--- a/lib/java/test/org/apache/thrift/test/TCompactProtocolTest.java
+++ b/lib/java/test/org/apache/thrift/test/TCompactProtocolTest.java
@@ -1,14 +1,27 @@
 
 package org.apache.thrift.test;
 
-import java.util.*;
+import java.util.Arrays;
+import java.util.List;
 
-import org.apache.thrift.transport.*;
-import org.apache.thrift.server.*;
-import org.apache.thrift.protocol.*;
-import org.apache.thrift.*;
+import org.apache.thrift.TBase;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TField;
+import org.apache.thrift.protocol.TMessage;
+import org.apache.thrift.protocol.TMessageType;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.protocol.TStruct;
+import org.apache.thrift.protocol.TType;
+import org.apache.thrift.transport.TMemoryBuffer;
 
-import thrift.test.*;
+import thrift.test.CompactProtoTestStruct;
+import thrift.test.HolyMoley;
+import thrift.test.Nesting;
+import thrift.test.OneOfEach;
+import thrift.test.Srv;
 
 public class TCompactProtocolTest {
 
diff --git a/lib/java/test/org/apache/thrift/test/TestNonblockingServer.java b/lib/java/test/org/apache/thrift/test/TestNonblockingServer.java
index 5df52da..0c122db 100644
--- a/lib/java/test/org/apache/thrift/test/TestNonblockingServer.java
+++ b/lib/java/test/org/apache/thrift/test/TestNonblockingServer.java
@@ -1,27 +1,11 @@
 package org.apache.thrift.test;
 
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TSimpleServer;
-import org.apache.thrift.server.TNonblockingServer;
 import org.apache.thrift.server.THsHaServer;
+import org.apache.thrift.server.TNonblockingServer;
+import org.apache.thrift.server.TServer;
 import org.apache.thrift.transport.TNonblockingServerSocket;
-import org.apache.thrift.transport.TNonblockingServerTransport;
-import org.apache.thrift.transport.TFramedTransport;
 
-// Generated code
-import thrift.test.*;
-
-import java.net.ServerSocket;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
+import thrift.test.ThriftTest;
 
 
 public class TestNonblockingServer extends TestServer {
diff --git a/lib/java/test/org/apache/thrift/test/TestServer.java b/lib/java/test/org/apache/thrift/test/TestServer.java
index a2f2d20..989fbe6 100644
--- a/lib/java/test/org/apache/thrift/test/TestServer.java
+++ b/lib/java/test/org/apache/thrift/test/TestServer.java
@@ -1,25 +1,24 @@
 package org.apache.thrift.test;
 
-import org.apache.thrift.TException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
 import org.apache.thrift.protocol.TProtocolFactory;
 import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TSimpleServer;
 import org.apache.thrift.server.TThreadPoolServer;
 import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TServerTransport;
 
-// Generated code
-import thrift.test.*;
-
-import java.net.ServerSocket;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Set;
-import java.util.HashSet;
+import thrift.test.Insanity;
+import thrift.test.Numberz;
+import thrift.test.ThriftTest;
+import thrift.test.Xception;
+import thrift.test.Xception2;
+import thrift.test.Xtruct;
+import thrift.test.Xtruct2;
 
 public class TestServer {