187 Commits

Author SHA1 Message Date
Dmytro Shteflyuk
604179840b Implemented Ruby fuzzing (#3339)
This PR implements fuzzing for Ruby library using https://github.com/trailofbits/ruzzy, a coverage-guided fuzzer for pure Ruby code and Ruby C extensions based on libFuzzer. Implemented binary, compact, and JSON protocol fuzzers.

A separate PR will follow to address OOM and a crash caused by unchecked memory allocation in structs (Edit: #3340).
2026-03-13 23:12:29 -07:00
HTHou
ded241d732 Remove threadsafe warnings in thrift-maven-plugin 2026-02-19 23:50:57 +01:00
Copilot
1e09a046e0 Add moveable_types=forward_setter option for perfect forwarding setters
Adds `forward_setter` value to `moveable_types` option, generating perfect forwarding setters for complex types while preserving traditional setters for primitives. Also fixes missing `operator<` implementation that caused link errors when structs are used as map keys.

**Forward Setter Generation** (`compiler/cpp/src/thrift/generate/t_cpp_generator.cc`):
- Parse `moveable_types=forward_setter` option
- Complex types (strings, containers, structs) → template setters with `std::forward<T_>`
- Primitive types → traditional const-ref setters
- Template implementations in `.tcc` file (auto-included in header)
- Legacy `moveable_types` behavior unchanged

**Compiler Unit Tests** (`compiler/cpp/tests/cpp/`):
- New `test_forward_setter.thrift` fixture
- Dedicated `t_cpp_generator_forward_setter_tests.cc` (91 assertions, 9 test cases)
- Verify `.tcc` generation and template implementations

**Integration Tests** (`test/cpp/src/`):
- `ForwardSetterTest.cpp` - validates lvalue/rvalue/temporary/literal setters with move semantics
- `PrivateOptionalTest.cpp` - SFINAE + static_assert verify optional fields are private
- `EnumClassTest.cpp` - type_traits + static_assert verify true enum class semantics

**CMakeLists.txt** (`test/cpp/`):
- Separate gen-cpp-{forward,private,enumclass} directories

**Makefile.am** (`test/cpp/`):
- Library targets for each option variant
- Proper `BUILT_SOURCES` dependencies
- Include path ordering: option-specific directory before standard `gen-cpp`

```cpp
// Generated with --gen cpp:moveable_types=forward_setter

struct TestStruct {
  int32_t primitive_field;
  std::string complex_field;

  void __set_primitive_field(const int32_t val);  // Traditional

  template <typename T_>
  void __set_complex_field(T_&& val);  // Perfect forwarding
};

// In .tcc file:
template <typename T_>
void TestStruct::__set_complex_field(T_&& val) {
  this->complex_field = ::std::forward<T_>(val);
  __isset.complex_field = true;
}
```

- [ ] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes)
- [ ] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
- [x] Did you squash your changes to a single commit?  (not required, but preferred)
- [x] Did you do your best to avoid breaking changes?  If one was needed, did you label the Jira ticket with "Breaking-Change"?

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: zsy056 <1074382+zsy056@users.noreply.github.com>
2026-02-08 22:09:37 +01:00
Copilot
ab178fbf24 Support C++ 11 enum class generation via pure_enums=enum_class
Adds C++ 11 `enum class` generation to the C++ code generator. When `pure_enums=enum_class` is specified, generates strongly-typed enums with proper scoping and type safety.

## Code Generator Changes

**Modified `t_cpp_generator.cc`:**
- Added `gen_enum_class_` flag parsed from `pure_enums=enum_class` option
- Modified `generate_enum()` to emit `enum class` when both `gen_pure_enums_` and `gen_enum_class_` are set
- Fixed enum value scoping: use `static_cast<int>(Color::RED)` for array initialization
- Fixed map operations: cast enum class to int in `find()` calls (no implicit conversion)

**Test infrastructure:**
- Created `t_cpp_generator_enum_class_tests.cc` with three test cases validating default, `pure_enums`, and `pure_enums=enum_class` behavior
- Extracted common utilities to `t_cpp_generator_test_utils.h` (shared with `private_optional` tests)
- Added expected output files: `expected_Color_{default,pure_enums,enum_class}.txt`

**Build system:**
- Added CMake compile-checks for generated code (both `private_optional` and `enum_class`)
- Unified compile-check blocks with shared Boost detection
- Ensures generated code compiles as part of standard test build

## Usage

```thrift
enum Color {
  RED = 1,
  GREEN = 2,
  BLUE = 3
}
```

```bash
thrift --gen cpp:pure_enums=enum_class example.thrift
```

Generates:
```cpp
enum class Color {
  RED = 1,
  GREEN = 2,
  BLUE = 3
};
```

Backward compatible - existing behavior unchanged when option absent.

---

- [ ] Did you create an [Apache Jira](https://issues.apache.org/jira/projects/THRIFT/issues/) ticket?  ([Request account here](https://selfserve.apache.org/jira-account.html), not required for trivial changes)
- [ ] If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
- [x] Did you squash your changes to a single commit?  (not required, but preferred)
- [x] Did you do your best to avoid breaking changes?  If one was needed, did you label the Jira ticket with "Breaking-Change"?
- [ ] If your change does not involve any code, include `[skip ci]` anywhere in the commit message to free up build resources.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: zsy056 <1074382+zsy056@users.noreply.github.com>
2026-01-28 01:29:06 +01:00
Dmytro Shteflyuk
4413220324 Fixed make check for Ruby library 2026-01-12 00:46:55 +01:00
Dmytro Shteflyuk
9aa75fb5d5 Commit Gemfile.lock for reproducible tests
Addressed a syntax error in the thrift.gemspec, and committed
Gemfile.lock files for both the gem and tests. Gems source switched
to https://rubygems.org.

This is a strongly recommended approach according to the Bundler team:

> As a result, you SHOULD check your Gemfile.lock into version control,
> in both applications and gems. If you do not, every machine that
> checks out your repository (including your production server) will
> resolve all dependencies again, which will result in different
> versions of third-party code being used if any of the gems in the
> Gemfile(5) or any of their dependencies have been updated.
https://bundler.io/man/bundle-install.1.html#THE-GEMFILE-LOCK

Also helps with Dependabot, which will be able to bump the lock file,
while we can relax version requirements in the gemspec.
2025-12-02 22:41:20 +01:00
zeshuai007
58d385eee2 Supplement Jsonprotocol module testcase
Client: rb
Patch: Zezeng Wang

This closes #2223
2025-12-01 22:17:49 +01:00
Jens Geyer
a4d458fdf3 THRIFT-5824 Migrate, refactor and improve Delphi code generation test script
Client: Delphi
Patch: Jens Geyer
2024-10-13 02:06:39 +02:00
Jens Geyer
564dbfc6fb Upgraded appveyor dockerfile reference to zlib to 1.2.13
Patch: JensG
2024-03-31 15:36:04 +02:00
Volodymyr Panivko
8e828c03d4 THRIFT-5756 Run php tests in github actions 2024-02-21 09:10:28 +01:00
Sergei Elin
4576409657 THRIFT-5635 Update erlang client for Erlang 23-25
Client: erl
Patch: Sergey Yelin

This closes #2677

Summary of changes:
 - Add useful compiler options
 - Format sources using erlfmt
 - Switch to modern callbacks in thrift_* modules
 - Add static analysis (dialyzer), disabled by default
 - Add/fix types for API calls

NOTE: Enabling static analysis requires additional tweaks in multiplexer module.
2023-07-22 13:16:08 +02:00
Jiayu Liu
1d61fe1c1f THRIFT-5633: move xenial to old, deprecate xenial in travis build (#2690)
* move xenial to old, deprecate xenial in travis build

* add back stage of docker
2022-10-10 08:45:10 +08:00
Kino Roy
a9da9eb059 THRIFT-4547: Swift crosstests (#2670)
Co-authored-by: Jiayu Liu <Jimexist@users.noreply.github.com>
2022-10-08 14:13:01 +08:00
Yawar Amin
b17672ac38 THRIFT-5208: fix OCaml struct and exn raising/handling codegen
Client: ocaml
Patch: Yawar Amin
2022-09-11 22:19:29 +02:00
Jens Geyer
f066d84ffb Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master 2022-09-05 22:04:22 +02:00
Jens Geyer
62445c1d2e THRIFT-5591 Add uuid type to IDL and implement reference code (+ improved self-tests)
Client: compiler general, netstd, Delphi
Patch: Jens Geyer
2022-09-05 22:04:20 +02:00
Jens Geyer
ce1d314ef3 THRIFT-5589 Haxe compiler/runtime fixes
Client: hx
Patch: Jens Geyer
2022-06-07 08:56:54 +02:00
Jiayu Liu
23b86364ef THRIFT-5570: update java lib document about gradle usage (#2583)
* update java doc about gradle usage
* update .gitignore
2022-05-06 00:42:18 -04:00
Jens Geyer
2c0927826d *.local deleted 2021-11-15 19:32:18 +01:00
Yuxuan 'fishy' Wang
a265236feb THRIFT-5447: Update supported Go versions
Client: go

Update go versions used in travis to 1.16.7 and 1.17, update
LANGUAGES.md, and update go's README to clarify on support policy.

This change will be cherry-picked into 0.15.0 branch after merged.
2021-08-19 14:09:24 -07:00
Jens Geyer
66f9536e2c THRIFT-5387 Improved and simplified Delphi test setup
Client: Delphi
Patch: Jens Geyer
2021-03-29 22:59:59 +02:00
Jens Geyer
2dcefadba8 THRIFT-5370 Haxe 4 compatibility incl TConfiguration & MAX_MESSAGE_SIZE
Client: haxe
Patch: Jens Geyer

This closes #2349
2021-03-17 20:42:29 +01:00
Allen George
de6f61aed0 THRIFT-4098 Namespace support for generated Rust code (#2348)
Client: rs
2021-03-11 08:25:26 -05:00
Jens Geyer
0d12832d92 misc. netstd improvements
Client: netstd
Patch: Jens Geyer

This closes #2344
2021-03-08 09:04:28 +01:00
Jens Geyer
cb094b80f2 THRIFT-5229 remove AS3 support
Client: AS3
Patch: Jens Geyer

This closes #2329
2021-02-14 11:18:01 +01:00
Jens Geyer
b5fe1dbc0c Reverted wrongly pushed commits.
- This reverts commit 876aee506b.
- This reverts commit b89316d54b.
2021-02-11 22:49:49 +01:00
Jens Geyer
b89316d54b Revert "THRIFT-4982 Remove deprecated C# bindings from the code base"
Only compiler, test, lib and tutorial code.
2021-02-10 20:27:08 +01:00
Jens Geyer
2ef0113d69 Consolidated gitignore & added missing EXTRA_DISTs 2021-02-05 12:58:49 +01:00
Allen George
7ddbcc07ec THRIFT-5306: Rust code and generated code no longer has clippy warnings (Rust 1.40)
Client: rs

NOTE: Also properly update the min/max supported Rust versions
2020-11-12 08:47:42 -05:00
Jens Geyer
56700e469d THRIFT-4982 Remove deprecated C# bindings from the code base
Client: csharp
Patch: Jens Geyer

This closes #2027
2020-02-28 19:18:34 +01:00
Jens Geyer
ed99455e2e THRIFT-5009 Serializer implemtation lacks support for layered transports
Client: Delphi
Patch: Jens Geyer
2019-11-14 22:17:39 +01:00
Qinghui Xu
17424372f3 THRIFT-4966: Ignore generated files
Client: Build Process
Patch: Qinghui Xu

This closes #1886
2019-10-06 12:21:52 +02:00
James E. King III
93ff9b0053 Update language levels, fix erlang and rust in CI
- Include rebar3 in docker image so erlang builds in CI
- Include the correct path in docker image so rust builds in CI
- Updated common lisp (sbcl) to 1.5.3 in docker image
- Updated dlang to 2.087.0 in docker image
- Updated dart to 2.0.0 in xenial docker image
- Updated dart to 2.4.0 in bionic docker image
- Updated erlang to 22.0 in docker image
- Updated openjdk to 11.0.3 in docker image
- Updated node.js to 10.16 in docker image
- Updated rust to 1.34.0 in xenial docker image
- Updated rust to 1.35.0 in bionic docker image

THRIFT-4905: Disable hanging experimental dlang async ssl test
2019-07-07 12:16:52 -04:00
Jens Geyer
5a17b13ebc THRIFT-4879 general performance improvements for netstd library
Client: netstd
Patch: Jens Geyer

This closes #1808
2019-06-04 22:31:58 +02:00
Sergey Yelin
4ffe76351e THRIFT-4583: Switch to rebar3
Client: erl
2019-05-13 06:52:19 -04:00
Jens Geyer
aa0c8b35d8 THRIFT-4723 Consolidate C#/netcore into new netstd language target
Client: netstd
Patch: Jens Geyer

This closes #1710
2019-01-28 23:12:28 +01:00
James E. King III
b1d63e7190 THRIFT-4750: as3 changes to build and publish to maven central 2019-01-24 12:20:30 -05:00
Rob Becker
f1eadad76e THRIFT-4654 Minor fixes for dart 1 & 2 compatibility (backwards compatible) (#1617)
* THRIFT-4654 Minor fixes for dart 1 & 2 compatibility
* update dockerfiles for CI to test dart 2
* THRIFT-4654 update pubspec for tests
* THRIFT-4654 update dart test generator and readme to 1.24.3
* THRIFT-4654 update generated dart sdk to a range
* fix the dart tutorials
* Add .dart_tool directories to .gitignore
* THRIFT-4654: use dart 2.1.0 and fix cross test dart client timeout
2019-01-21 22:24:01 -05:00
James E. King III
a3a7c6c789 THRIFT-4547: add swift to bionic build image and run unit tests 2019-01-02 15:20:23 -05:00
Allen George
54e9587117 THRIFT-4676: Fix intermittent CL build failures 2018-12-05 16:09:10 -05:00
James E. King III
12f8b14fff THRIFT-3458: additional dub.json changes 2018-09-16 19:56:29 -04:00
Jens Geyer
af7ecd6a2b THRIFT-4590 running the test client using HTTP transport leads to "CoInitialize not called"
Client: Delphi
Patch: Jens Geyer
2018-06-22 23:05:17 +02:00
James E. King III
b92ca5f226 THRIFT-4582: Fix Xenial CI build issues (#1563)
* THRIFT-4582: fix xenial build issues

* THRIFT-2913: fix Thrift::ThreadPoolServer should serve inside a thread on xenial

* THRIFT-4478: Move Xenial up to dmd 2.075.1 as that is the new minimum
version that works since the changes for 2.080.0 went in.
2018-06-09 23:02:12 -04:00
Jens Geyer
c564651dd4 THRIFT-4554 uncompileable code with member names that are also types under specific conditions
Client: Delphi
Patch: Jens Geyer

This closes #1539
2018-04-14 00:51:41 +02:00
Jens Geyer
d4fb364d30 ignores modified 2018-03-31 10:38:39 +02:00
Philip Frank
5066eb484b THRIFT-4509:
* switch from grunt-external-daemon and grunt-shell to grunt-shell-spawn
* update grunt to 1.0.2
* always use local copy of jquery and qunit
* commit the package-lock files for npm keep versions stable
Client: js

This closes #1506
2018-03-13 10:12:04 -04:00
Tomek Kurcz
e93a901715 THRIFT-82: Add Common Lisp support
Client: cl

There's framed and buffered socket transport, binary protocol, multiplex, simple
server, cross-tests, self-tests, tutorial, CL library, CL code generator. Only
SBCL is supported for now.

This closes #1412
2018-03-02 13:44:50 -05:00
James E. King III
d907cc92db THRIFT-4352: update artful to use haxe 3.4.4 which fixes a core in haxe 2018-02-17 11:20:07 -05:00
Alex Volanis
7004a61e44 THRIFT-(1418|1507|3983|4120|4178|4259|4294): Multiple issues
Client: java

THRIFT-4294: Java Configure Fails for Ant >= 1.10
THRIFT-4259: Thrift does not compile due to Ant Maven task errors
THRIFT-4178: Java libraries missing from package when using cmake
THRIFT-3983: libthrift is deployed on central with pom packaging
             instead of jar
THRIFT-1507: Maven can't download resource from central when behind
             a proxy and won't use local repository
THRIFT-1418: Compiling Thrift from source: Class
             org.apache.tools.ant.taskdefs.ConditionTask doesn't
             support the nested "typefound" element

Refactor CMake install hook to allow using "sudo make install/fast"
which avoids the THRIFT-1507 and THRIFT-1418 issues.

New Gradle based build system for Thrift Java Library

* Add Gradle 4.4.1 Wrapper artifacts to enable builds
Using the Gradle Wrapper helps normalize the builds on all platforms
so we use a consistent build tool independent of package managers.

The Gradle build logic was partitioned into multiple specific
scripts to simplify understanding and maintenance of the build.

This is now hooked into CMake and Autoconf processing steps
and can build/test/publish to Maven. The README.md was updated
to illustrate the new build options and add some documentation
on the requirements for Maven publication.

Cleaned up the CMake files to reduce reliance on file globbing
which is known to cause confusion when multiple users contribute.

* Fix two minor issues in Javadoc and unit test

Return values were undeclared in Javadoc
Test was asserting on the wrong test object instance

* Create simple runner scripts for cross-check

Using Gradle as a java execution wrapper is too heavy.
I simplified the test client/server execution by using a
three generated scripts in the build directory direcly
callable by the cross-check test harness.

* Cleanup the remaining Ant build scripts

Pulled the Maven Ant task properties out of the Java build
since they are no longer used there.
Deleted the no longer used build.xml and build.properties
files from the Java build.
Made each Ant build own the Maven Ant task details in their
build.properties file.

* Fix the build issue with Java SSL in the ubuntu-trusty container

The latest Trusty JDK7 builds seem to have encountered this issue
because the OpenJDK removed the SunEC algorithms.

* Update the developer info as requested in review

Use the generic Apache Thrift developer list for contact information

* Add Clover Code coverage for easy access by developers

Clover plugin for Gradle was applied and configured which enables
code coverage reports to be available on demand via a command line
option. The documentation in the README.md was enhanced to give
the details of this change and how to take advantage of it.
2018-01-24 12:28:55 -05:00
Dmitry Volodin
f92493b857 THRIFT-4470: Include popular IDE file templates to gitignore
This closes #1477
2018-01-24 00:12:30 -05:00