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.
diff --git a/lib/erl/include/thrift_constants.hrl b/lib/erl/include/thrift_constants.hrl
index 7cb29eb..4096854 100644
--- a/lib/erl/include/thrift_constants.hrl
+++ b/lib/erl/include/thrift_constants.hrl
@@ -41,10 +41,16 @@
% TApplicationException
-define(TApplicationException_Structure,
- {struct, [{1, string},
- {2, i32}]}).
+ {struct, [
+ {1, string},
+ {2, i32}
+ ]}
+).
--record('TApplicationException', {message, type}).
+-record('TApplicationException', {
+ message :: string(),
+ type :: integer()
+}).
-define(TApplicationException_UNKNOWN, 0).
-define(TApplicationException_UNKNOWN_METHOD, 1).
@@ -58,5 +64,5 @@
-define(TApplicationException_INVALID_PROTOCOL, 9).
-define(TApplicationException_UNSUPPORTED_CLIENT_TYPE, 10).
--define (MULTIPLEXED_SERVICE_SEPARATOR, ":").
--define (MULTIPLEXED_ERROR_HANDLER_KEY, "error_handler").
+-define(MULTIPLEXED_SERVICE_SEPARATOR, ":").
+-define(MULTIPLEXED_ERROR_HANDLER_KEY, "error_handler").