From bb8cac570441e543265fd2402a162a5a889a216f Mon Sep 17 00:00:00 2001 From: Kurt Alfred Kluever Date: Sat, 28 Dec 2024 21:56:46 -0500 Subject: [PATCH] Update generated array style C-style array declarations (e.g. `Foo foos[]`) is discouraged by the JLS. Java style (e.g., `Foo[] foos`) should be preferred. --- compiler/cpp/src/thrift/generate/t_java_generator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/cpp/src/thrift/generate/t_java_generator.cc b/compiler/cpp/src/thrift/generate/t_java_generator.cc index e81744e07b0..d944e261146 100644 --- a/compiler/cpp/src/thrift/generate/t_java_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_java_generator.cc @@ -1629,7 +1629,7 @@ void t_java_generator::generate_java_struct_definition(ostream& out, } if (optionals > 0) { - std::string output_string = "private static final _Fields optionals[] = {"; + std::string output_string = "private static final _Fields[] optionals = {"; for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { if ((*m_iter)->get_req() == t_field::T_OPTIONAL) { output_string = output_string + "_Fields." + constant_name((*m_iter)->get_name()) + ",";