THRIFT-5526 to use "private_members" instead of "private-members" as a consistent param casing
Client: java
Patch: Jiayu Liu

This closes #2531
diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc
index 3fa5f57..2329396 100644
--- a/compiler/cpp/src/thrift/generate/t_java_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc
@@ -78,7 +78,8 @@
         bean_style_ = true;
       } else if( iter->first.compare("android") == 0) {
         android_style_ = true;
-      } else if( iter->first.compare("private-members") == 0) {
+      } else if( iter->first.compare("private_members") == 0 || iter->first.compare("private-members") == 0) {
+        // keep both private_members and private-members (legacy) for backwards compatibility
         private_members_ = true;
       } else if( iter->first.compare("nocamel") == 0) {
         nocamel_style_ = true;
@@ -5439,8 +5440,9 @@
     java,
     "Java",
     "    beans:           Members will be private, and setter methods will return void.\n"
-    "    private-members: Members will be private, but setter methods will return 'this' like "
+    "    private_members: Members will be private, but setter methods will return 'this' like "
     "usual.\n"
+    "    private-members: Same as 'private_members' (deprecated).\n"
     "    nocamel:         Do not use CamelCase field accessors with beans.\n"
     "    fullcamel:       Convert underscored_accessor_or_service_names to camelCase.\n"
     "    android:         Generated structures are Parcelable.\n"
diff --git a/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThrift.java b/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThrift.java
index 7c7891e..1bc10a6 100644
--- a/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThrift.java
+++ b/contrib/thrift-maven-plugin/src/test/java/org/apache/thrift/maven/TestThrift.java
@@ -73,7 +73,7 @@
 
     @Test
     public void testThriftCompileWithGeneratorOption() throws Exception {
-        builder.setGenerator("java:private-members");
+        builder.setGenerator("java:private_members");
         executeThriftCompile();
     }