THRIFT-5525 use "reuse_objects" instead of "reuse-objects" as a consistent param casing
Client: java
Patch: Jiayu Liu
This closes #2530
diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc
index 2329396..f43cf5f 100644
--- a/compiler/cpp/src/thrift/generate/t_java_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc
@@ -91,7 +91,8 @@
sorted_containers_ = true;
} else if( iter->first.compare("java5") == 0) {
java5_ = true;
- } else if( iter->first.compare("reuse-objects") == 0) {
+ } else if( iter->first.compare("reuse_objects") == 0 || iter->first.compare("reuse-objects") == 0) {
+ // keep both reuse_objects and reuse-objects (legacy) for backwards compatibility
reuse_objects_ = true;
} else if( iter->first.compare("option_type") == 0) {
use_option_type_ = true;
@@ -5453,8 +5454,9 @@
" Enable rethrow of unhandled exceptions and let them propagate further."
" (Default behavior is to catch and log it.)\n"
" java5: Generate Java 1.5 compliant code (includes android_legacy flag).\n"
- " reuse-objects: Data objects will not be allocated, but existing instances will be used "
+ " reuse_objects: Data objects will not be allocated, but existing instances will be used "
"(read and write).\n"
+ " reuse-objects: Same as 'reuse_objects' (deprecated).\n"
" sorted_containers:\n"
" Use TreeSet/TreeMap instead of HashSet/HashMap as a implementation of "
"set/map.\n"
diff --git a/lib/java/gradle/generateTestThrift.gradle b/lib/java/gradle/generateTestThrift.gradle
index 996c5fa..924dd0d 100644
--- a/lib/java/gradle/generateTestThrift.gradle
+++ b/lib/java/gradle/generateTestThrift.gradle
@@ -109,7 +109,7 @@
ext.outputBuffer = new ByteArrayOutputStream()
- thriftCompile(it, 'ReuseObjects.thrift', 'java:reuse-objects', genReuseSrc)
+ thriftCompile(it, 'ReuseObjects.thrift', 'java:reuse_objects', genReuseSrc)
}
task generateUnsafeBinariesJava(group: 'Build') {