Skip to content

THRIFT-6529: Include the service name in the Haxe argument and result struct names - #4133

Merged
Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6529
Nov 7, 2026
Merged

Jens-G merged 1 commit into
apache:masterfrom
Jens-G:THRIFT-6529

Conversation

@Jens-G

@Jens-G Jens-G commented Nov 7, 2026

Copy link
Copy Markdown
Member

THRIFT-6529

The Haxe generator named the argument and result structs of a method after the method alone, as classes of the package. Two services of one namespace with a method of the same name thus wrote the same classes, and the one written last won. The names now start with the name of the service that declares the method, as in the C++, JavaScript and PHP generators: A_get_args and A_get_result instead of Get_args and Get_result.

This renames these classes and their files for every service. The struct descriptor and toString() of an argument struct now carry the class name, as those of a result struct already did. Otherwise the generated code stays the same.

This is what turns lib-haxe-codegen red on #4065: its netstd fixture IsolatedNames.thrift has methods of the same names in three services, with and without arguments.

Tested on today's master:

  • The new compiler test compiler/cpp/tests/haxe/t_haxe_generator_service_tests.cc fails without the change and passes with it; all other compiler tests pass either way.
  • lib/haxe/codegen/run-Haxe-Codegen-Tests.ps1 with Haxe 4.3.6 and a two-service IDL as an extra file: without the change, it stops at that file with Get_args has no field a; with it, it ends with Success (252 tests executed). On master merged with THRIFT-5830: Add per-call transport isolation for netstd clients #4065, it ends with Success (254 tests executed).
  • The Haxe library tests of the lib-haxe-codegen job pass: the unit tests on neko, and the js TSocket test under Node.
  • For each of the 254 IDL files of the repository that the compiler accepts, the generated code is the same as before once the new names are mapped back. In three of them, the old compiler had already written one struct for the methods of two services, which went unnoticed because the structs were the same: lib/go/test/NamesTest.thrift, test/AnnotationTest.thrift (foo and Foo, apart from the descriptor name) and test/Service.thrift with its include.

🤖 Generated with Claude Code

… struct names

Client: haxe

The Haxe generator named the argument and result structs of a method
after the method alone, as classes of the package. Two services of one
package with a method of the same name thus wrote the same classes, and
the one written last won: the generated code did not compile, or one
service used the structs of the other.

The names now start with the name of the service that declares the
method, as in the C++, JavaScript and PHP generators: A_get_args and
A_get_result instead of Get_args and Get_result. This renames these
classes, and their files, for every service. The struct descriptor and
toString of an argument struct now carry the class name, as those of a
result struct already did.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jens-G
Jens-G merged commit 783e53f into apache:master Nov 7, 2026
92 checks passed
@Jens-G
Jens-G deleted the THRIFT-6529 branch November 7, 2026 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant