You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2022/03/02 21:23:38 UTC
[thrift] 01/02: THRIFT-5526 to use "private_members" instead of "private-members" as a consistent param casing Client: java Patch: Jiayu Liu
This is an automated email from the ASF dual-hosted git repository.
jensg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git
commit 4bd1fd80791380de443bb217d7456b7ade56cf8a
Author: Jiayu Liu <ji...@airbnb.com>
AuthorDate: Tue Feb 22 23:22:04 2022 +0800
THRIFT-5526 to use "private_members" instead of "private-members" as a consistent param casing
Client: java
Patch: Jiayu Liu
This closes #2531
---
compiler/cpp/src/thrift/generate/t_java_generator.cc | 6 ++++--
.../src/test/java/org/apache/thrift/maven/TestThrift.java | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
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 @@ public:
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 @@ THRIFT_REGISTER_GENERATOR(
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 @@ public class TestThrift {
@Test
public void testThriftCompileWithGeneratorOption() throws Exception {
- builder.setGenerator("java:private-members");
+ builder.setGenerator("java:private_members");
executeThriftCompile();
}