THRIFT-1050. java: Declaring an argument named 'manager' to a service method produces code that fails compile due to name conflicts with protected ivars in TAsyncClient

This patch adds a triple-underscore prefix to all the ivars in TAsyncClient, making it substantially more difficult to get a conflict.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1081868 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc
index e84fd1d..3fa9b16 100644
--- a/compiler/cpp/src/generate/t_java_generator.cc
+++ b/compiler/cpp/src/generate/t_java_generator.cc
@@ -2472,9 +2472,9 @@
     // Main method body   
     indent(f_service_) << "public " << function_signature_async(*f_iter, false) << " throws org.apache.thrift.TException {" << endl;
     indent(f_service_) << "  checkReady();" << endl;
-    indent(f_service_) << "  " << funclassname << " method_call = new " + funclassname + "(" << async_argument_list(*f_iter, arg_struct, ret_type) << ", this, protocolFactory, transport);" << endl;
-    indent(f_service_) << "  this.currentMethod = method_call;" << endl;
-    indent(f_service_) << "  manager.call(method_call);" << endl;
+    indent(f_service_) << "  " << funclassname << " method_call = new " + funclassname + "(" << async_argument_list(*f_iter, arg_struct, ret_type) << ", this, ___protocolFactory, ___transport);" << endl;
+    indent(f_service_) << "  this.___currentMethod = method_call;" << endl;
+    indent(f_service_) << "  ___manager.call(method_call);" << endl;
     indent(f_service_) << "}" << endl;
 
     f_service_ << endl;
diff --git a/lib/java/src/org/apache/thrift/async/TAsyncClient.java b/lib/java/src/org/apache/thrift/async/TAsyncClient.java
index 468bc6e..d3b009a 100644
--- a/lib/java/src/org/apache/thrift/async/TAsyncClient.java
+++ b/lib/java/src/org/apache/thrift/async/TAsyncClient.java
@@ -22,38 +22,38 @@
 import org.apache.thrift.transport.TNonblockingTransport;
 
 public abstract class TAsyncClient {
-  protected final TProtocolFactory protocolFactory;
-  protected final TNonblockingTransport transport;
-  protected final TAsyncClientManager manager;
-  protected TAsyncMethodCall currentMethod;
-  private Exception error;
-  private long timeout;
+  protected final TProtocolFactory ___protocolFactory;
+  protected final TNonblockingTransport ___transport;
+  protected final TAsyncClientManager ___manager;
+  protected TAsyncMethodCall ___currentMethod;
+  private Exception ___error;
+  private long ___timeout;
 
   public TAsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager manager, TNonblockingTransport transport) {
     this(protocolFactory, manager, transport, 0);
   }
 
   public TAsyncClient(TProtocolFactory protocolFactory, TAsyncClientManager manager, TNonblockingTransport transport, long timeout) {
-    this.protocolFactory = protocolFactory;
-    this.manager = manager;
-    this.transport = transport;
-    this.timeout = timeout;
+    this.___protocolFactory = protocolFactory;
+    this.___manager = manager;
+    this.___transport = transport;
+    this.___timeout = timeout;
   }
 
   public TProtocolFactory getProtocolFactory() {
-    return protocolFactory;
+    return ___protocolFactory;
   }
 
   public long getTimeout() {
-    return timeout;
+    return ___timeout;
   }
 
   public boolean hasTimeout() {
-    return timeout > 0;
+    return ___timeout > 0;
   }
 
   public void setTimeout(long timeout) {
-    this.timeout = timeout;
+    this.___timeout = timeout;
   }
 
   /**
@@ -61,7 +61,7 @@
    * @return
    */
   public boolean hasError() {
-    return error != null;
+    return ___error != null;
   }
 
   /**
@@ -69,18 +69,18 @@
    * @return
    */
   public Exception getError() {
-    return error;
+    return ___error;
   }
 
   protected void checkReady() {
     // Ensure we are not currently executing a method
-    if (currentMethod != null) {
-      throw new IllegalStateException("Client is currently executing another method: " + currentMethod.getClass().getName());
+    if (___currentMethod != null) {
+      throw new IllegalStateException("Client is currently executing another method: " + ___currentMethod.getClass().getName());
     }
 
     // Ensure we're not in an error state
-    if (error != null) {
-      throw new IllegalStateException("Client has an error!", error);
+    if (___error != null) {
+      throw new IllegalStateException("Client has an error!", ___error);
     }
   }
 
@@ -88,15 +88,15 @@
    * Called by delegate method when finished
    */
   protected void onComplete() {
-    currentMethod = null;
+    ___currentMethod = null;
   }
 
   /**
    * Called by delegate method on error
    */
   protected void onError(Exception exception) {
-    transport.close();
-    currentMethod = null;
-    error = exception;
+    ___transport.close();
+    ___currentMethod = null;
+    ___error = exception;
   }
 }