Revert "THRIFT-3834 Erlang namespacing and exception metadata"
This reverts commit c8deed8cba62dce0ce816afef38f708ce49d0a61.
diff --git a/compiler/cpp/src/generate/t_erl_generator.cc b/compiler/cpp/src/generate/t_erl_generator.cc
index 9118b48..0e7f7f1 100644
--- a/compiler/cpp/src/generate/t_erl_generator.cc
+++ b/compiler/cpp/src/generate/t_erl_generator.cc
@@ -56,8 +56,6 @@
legacy_names_ = false;
maps_ = false;
otp16_ = false;
- erl_namespace_ = program->get_namespace("erl");
-
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
if( iter->first.compare("legacynames") == 0) {
legacy_names_ = true;
@@ -66,7 +64,7 @@
} else if( iter->first.compare("otp16") == 0) {
otp16_ = true;
} else {
- throw "unknown option erl:" + iter->first;
+ throw "unknown option erl:" + iter->first;
}
}
@@ -182,8 +180,6 @@
/* if true use non-namespaced dict and set instead of dict:dict and sets:set */
bool otp16_;
- /* A namespace that gets appended to our generated structs. */
- std::string erl_namespace_;
/**
* add function to export list
*/
@@ -231,7 +227,6 @@
*/
std::vector<std::string> v_struct_names_;
std::vector<std::string> v_enum_names_;
- std::vector<std::string> v_exception_names_;
std::vector<t_enum*> v_enums_;
};
@@ -344,7 +339,6 @@
export_types_string("enum_info", 1);
export_types_string("enum_names", 0);
export_types_string("struct_names", 0);
- export_types_string("exception_names", 0);
f_types_file_ << "-export([" << export_types_lines_.str() << "])." << endl << endl;
@@ -357,7 +351,6 @@
generate_type_metadata("struct_names", v_struct_names_);
generate_enum_metadata();
generate_type_metadata("enum_names", v_enum_names_);
- generate_type_metadata("exception_names", v_exception_names_);
hrl_footer(f_types_hrl_file_, string("BOGUS"));
@@ -376,7 +369,7 @@
for(size_t i=0; i < num_structs; i++) {
- f_types_file_ << names.at(i);
+ f_types_file_ << atomify(names.at(i));
if (i < num_structs - 1) {
f_types_file_ << ", ";
@@ -407,7 +400,7 @@
vector<t_enum_value*>::iterator c_iter;
v_enums_.push_back(tenum);
- v_enum_names_.push_back(atomify(tenum->get_name()));
+ v_enum_names_.push_back(tenum->get_name());
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
int value = (*c_iter)->get_value();
@@ -504,7 +497,7 @@
indent(out) << value->get_integer();
} else if (type->is_struct() || type->is_xception()) {
- out << "#" << type_name(type) << "{";
+ out << "#" << atomify(type->get_name()) << "{";
const vector<t_field*>& fields = ((t_struct*)type)->get_members();
vector<t_field*>::const_iterator f_iter;
const map<t_const_value*, t_const_value*>& val = value->get_map();
@@ -589,7 +582,7 @@
string t_erl_generator::render_default_value(t_field* field) {
t_type* type = field->get_type();
if (type->is_struct() || type->is_xception()) {
- return "#" + type_name(type) + "{}";
+ return "#" + atomify(type->get_name()) + "{}";
} else if (type->is_map()) {
if (maps_) {
return "#{}";
@@ -627,7 +620,7 @@
} else if (type->is_enum()) {
return "integer()";
} else if (type->is_struct() || type->is_xception()) {
- return type_name(type) + "()";
+ return atomify(type->get_name()) + "()";
} else if (type->is_map()) {
if (maps_) {
return "#{}";
@@ -664,7 +657,7 @@
* Generates a struct
*/
void t_erl_generator::generate_struct(t_struct* tstruct) {
- v_struct_names_.push_back(type_name(tstruct));
+ v_struct_names_.push_back(tstruct->get_name());
generate_erl_struct(tstruct, false);
}
@@ -675,7 +668,6 @@
* @param txception The struct definition
*/
void t_erl_generator::generate_xception(t_struct* txception) {
- v_exception_names_.push_back(type_name(txception));
generate_erl_struct(txception, true);
}
@@ -1017,10 +1009,6 @@
string t_erl_generator::type_name(t_type* ttype) {
string prefix = "";
- if (erl_namespace_.length() > 0) {
- prefix = erl_namespace_ + ".";
- }
-
string name = ttype->get_name();
if (ttype->is_struct() || ttype->is_xception() || ttype->is_service()) {
diff --git a/lib/erl/test/thrift_test_test.erl b/lib/erl/test/thrift_test_test.erl
index ae20f31..e506437 100644
--- a/lib/erl/test/thrift_test_test.erl
+++ b/lib/erl/test/thrift_test_test.erl
@@ -33,32 +33,32 @@
record_generation_test_() ->
[
{"Bonk record", ?_assertMatch(
- {'thrift.test.Bonk', _, _},
- #'thrift.test.Bonk'{message=null,type=null}
+ {'Bonk', _, _},
+ #'Bonk'{message=null,type=null}
)},
{"Bools record", ?_assertMatch(
- {'thrift.test.Bools', _, _},
- #'thrift.test.Bools'{im_true=null,im_false=null}
+ {'Bools', _, _},
+ #'Bools'{im_true=null,im_false=null}
)},
{"Xtruct record", ?_assertMatch(
- {'thrift.test.Xtruct', _, _, _, _},
- #'thrift.test.Xtruct'{string_thing=null,byte_thing=null,i32_thing=null,i64_thing=null}
+ {'Xtruct', _, _, _, _},
+ #'Xtruct'{string_thing=null,byte_thing=null,i32_thing=null,i64_thing=null}
)},
{"Xtruct2 record", ?_assertMatch(
- {'thrift.test.Xtruct2', _, _, _},
- #'thrift.test.Xtruct2'{byte_thing=null,struct_thing=null,i32_thing=null}
+ {'Xtruct2', _, _, _},
+ #'Xtruct2'{byte_thing=null,struct_thing=null,i32_thing=null}
)},
{"Xtruct3 record", ?_assertMatch(
- {'thrift.test.Xtruct3', _, _, _, _},
- #'thrift.test.Xtruct3'{string_thing=null,changed=null,i32_thing=null,i64_thing=null}
+ {'Xtruct3', _, _, _, _},
+ #'Xtruct3'{string_thing=null,changed=null,i32_thing=null,i64_thing=null}
)},
{"Insanity record", ?_assertMatch(
- {'thrift.test.Insanity', _, _},
- #'thrift.test.Insanity'{userMap=null,xtructs=null}
+ {'Insanity', _, _},
+ #'Insanity'{userMap=null,xtructs=null}
)},
{"CrazyNesting record", ?_assertMatch(
- {'thrift.test.CrazyNesting', _, _, _, _},
- #'thrift.test.CrazyNesting'{
+ {'CrazyNesting', _, _, _, _},
+ #'CrazyNesting'{
string_field=null,
set_field=null,
list_field=null,
@@ -66,22 +66,22 @@
}
)},
{"Xception record", ?_assertMatch(
- {'thrift.test.Xception', _, _},
- #'thrift.test.Xception'{errorCode=null,message=null}
+ {'Xception', _, _},
+ #'Xception'{errorCode=null,message=null}
)},
{"Xception2 record", ?_assertMatch(
- {'thrift.test.Xception2', _, _},
- #'thrift.test.Xception2'{errorCode=null,struct_thing=null}
+ {'Xception2', _, _},
+ #'Xception2'{errorCode=null,struct_thing=null}
)},
- {"EmptyStruct record", ?_assertMatch({'thrift.test.EmptyStruct'}, #'thrift.test.EmptyStruct'{})},
- {"OneField record", ?_assertMatch({'thrift.test.OneField', _}, #'thrift.test.OneField'{field=null})},
+ {"EmptyStruct record", ?_assertMatch({'EmptyStruct'}, #'EmptyStruct'{})},
+ {"OneField record", ?_assertMatch({'OneField', _}, #'OneField'{field=null})},
{"VersioningTestV1 record", ?_assertMatch(
- {'thrift.test.VersioningTestV1', _, _, _},
- #'thrift.test.VersioningTestV1'{begin_in_both=null,old_string=null,end_in_both=null}
+ {'VersioningTestV1', _, _, _},
+ #'VersioningTestV1'{begin_in_both=null,old_string=null,end_in_both=null}
)},
{"VersioningTestV2 record", ?_assertMatch(
- {'thrift.test.VersioningTestV2', _, _, _, _, _, _, _, _, _, _, _, _},
- #'thrift.test.VersioningTestV2'{
+ {'VersioningTestV2', _, _, _, _, _, _, _, _, _, _, _, _},
+ #'VersioningTestV2'{
begin_in_both=null,
newint=null,
newbyte=null,
@@ -97,20 +97,20 @@
}
)},
{"ListTypeVersioningV1 record", ?_assertMatch(
- {'thrift.test.ListTypeVersioningV1', _, _},
- #'thrift.test.ListTypeVersioningV1'{myints=null,hello=null}
+ {'ListTypeVersioningV1', _, _},
+ #'ListTypeVersioningV1'{myints=null,hello=null}
)},
{"ListTypeVersioningV2 record", ?_assertMatch(
- {'thrift.test.ListTypeVersioningV2', _, _},
- #'thrift.test.ListTypeVersioningV2'{strings=null,hello=null}
+ {'ListTypeVersioningV2', _, _},
+ #'ListTypeVersioningV2'{strings=null,hello=null}
)},
{"GuessProtocolStruct record", ?_assertMatch(
- {'thrift.test.GuessProtocolStruct', _},
- #'thrift.test.GuessProtocolStruct'{map_field=null}
+ {'GuessProtocolStruct', _},
+ #'GuessProtocolStruct'{map_field=null}
)},
{"LargeDeltas record", ?_assertMatch(
- {'thrift.test.LargeDeltas', _, _, _, _, _, _, _, _, _, _},
- #'thrift.test.LargeDeltas'{
+ {'LargeDeltas', _, _, _, _, _, _, _, _, _, _},
+ #'LargeDeltas'{
b1=null,
b10=null,
b100=null,
@@ -124,34 +124,34 @@
}
)},
{"NestedListsI32x2 record", ?_assertMatch(
- {'thrift.test.NestedListsI32x2', _},
- #'thrift.test.NestedListsI32x2'{integerlist=null}
+ {'NestedListsI32x2', _},
+ #'NestedListsI32x2'{integerlist=null}
)},
{"NestedListsI32x3 record", ?_assertMatch(
- {'thrift.test.NestedListsI32x3', _},
- #'thrift.test.NestedListsI32x3'{integerlist=null}
+ {'NestedListsI32x3', _},
+ #'NestedListsI32x3'{integerlist=null}
)},
{"NestedMixedx2 record", ?_assertMatch(
- {'thrift.test.NestedMixedx2', _, _, _},
- #'thrift.test.NestedMixedx2'{
+ {'NestedMixedx2', _, _, _},
+ #'NestedMixedx2'{
int_set_list=null,
map_int_strset=null,
map_int_strset_list=null
}
)},
- {"ListBonks record", ?_assertMatch({'thrift.test.ListBonks', _}, #'thrift.test.ListBonks'{bonk=null})},
+ {"ListBonks record", ?_assertMatch({'ListBonks', _}, #'ListBonks'{bonk=null})},
{"NestedListsBonk record", ?_assertMatch(
- {'thrift.test.NestedListsBonk', _},
- #'thrift.test.NestedListsBonk'{bonk=null}
+ {'NestedListsBonk', _},
+ #'NestedListsBonk'{bonk=null}
)},
{"BoolTest record", ?_assertMatch(
- {'thrift.test.BoolTest', _, _},
- #'thrift.test.BoolTest'{b=null,s=null}
+ {'BoolTest', _, _},
+ #'BoolTest'{b=null,s=null}
)},
- {"StructA record", ?_assertMatch({'thrift.test.StructA', _}, #'thrift.test.StructA'{s=null})},
+ {"StructA record", ?_assertMatch({'StructA', _}, #'StructA'{s=null})},
{"StructB record", ?_assertMatch(
- {'thrift.test.StructB', _, _},
- #'thrift.test.StructB'{aa=null,ab=null}
+ {'StructB', _, _},
+ #'StructB'{aa=null,ab=null}
)}
].
@@ -159,21 +159,21 @@
[
{"Bonk definition (short version)", ?_assertEqual(
{struct, [{1, string}, {2, i32}]},
- thrift_test_types:struct_info('thrift.test.Bonk')
+ thrift_test_types:struct_info('Bonk')
)},
{"Bonk definition", ?_assertEqual(
{struct, [
{1, undefined, string, message, undefined},
{2, undefined, i32, type, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.Bonk')
+ thrift_test_types:struct_info_ext('Bonk')
)},
{"Bools definition", ?_assertEqual(
{struct, [
{1, undefined, bool, im_true, undefined},
{2, undefined, bool, im_false, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.Bools')
+ thrift_test_types:struct_info_ext('Bools')
)},
{"Xtruct definition", ?_assertEqual(
{struct, [
@@ -182,15 +182,15 @@
{9, undefined, i32, i32_thing, undefined},
{11, undefined, i64, i64_thing, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.Xtruct')
+ thrift_test_types:struct_info_ext('Xtruct')
)},
{"Xtruct2 definition", ?_assertEqual(
{struct, [
{1, undefined, byte, byte_thing, undefined},
- {2, undefined, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}, struct_thing, #'thrift.test.Xtruct'{}},
+ {2, undefined, {struct, {'thrift_test_types', 'Xtruct'}}, struct_thing, #'Xtruct'{}},
{3, undefined, i32, i32_thing, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.Xtruct2')
+ thrift_test_types:struct_info_ext('Xtruct2')
)},
{"Xtruct3 definition", ?_assertEqual(
{struct, [
@@ -199,50 +199,50 @@
{9, undefined, i32, i32_thing, undefined},
{11, undefined, i64, i64_thing, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.Xtruct3')
+ thrift_test_types:struct_info_ext('Xtruct3')
)},
{"Insanity definition", ?_assertEqual(
{struct, [
{1, undefined, {map, i32, i64}, userMap, dict:new()},
- {2, undefined, {list, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}}, xtructs, []}
+ {2, undefined, {list, {struct, {'thrift_test_types', 'Xtruct'}}}, xtructs, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.Insanity')
+ thrift_test_types:struct_info_ext('Insanity')
)},
{"CrazyNesting definition", ?_assertEqual(
{struct, [
{1, undefined, string, string_field, undefined},
- {2, optional, {set, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}}, set_field, sets:new()},
- {3, required, {list, {map,
+ {2, optional, {set, {struct, {'thrift_test_types', 'Insanity'}}}, set_field, sets:new()},
+ {3, required, {list, {map,
{set, i32},
- {map, i32, {set, {list, {map, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}, string}}}}
+ {map, i32, {set, {list, {map, {struct, {'thrift_test_types', 'Insanity'}}, string}}}}
}}, list_field, []},
{4, undefined, string, binary_field, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.CrazyNesting')
+ thrift_test_types:struct_info_ext('CrazyNesting')
)},
{"Xception definition", ?_assertEqual(
{struct, [
{1, undefined, i32, errorCode, undefined},
{2, undefined, string, message, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.Xception')
+ thrift_test_types:struct_info_ext('Xception')
)},
{"Xception2 definition", ?_assertEqual(
{struct, [
{1, undefined, i32, errorCode, undefined},
- {2, undefined, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}, struct_thing, #'thrift.test.Xtruct'{}}
+ {2, undefined, {struct, {'thrift_test_types', 'Xtruct'}}, struct_thing, #'Xtruct'{}}
]},
- thrift_test_types:struct_info_ext('thrift.test.Xception2')
+ thrift_test_types:struct_info_ext('Xception2')
)},
{"EmptyStruct definition", ?_assertEqual(
{struct, []},
- thrift_test_types:struct_info_ext('thrift.test.EmptyStruct')
+ thrift_test_types:struct_info_ext('EmptyStruct')
)},
{"OneField definition", ?_assertEqual(
{struct, [
- {1, undefined, {struct, {'thrift_test_types', 'thrift.test.EmptyStruct'}}, field, #'thrift.test.EmptyStruct'{}}
+ {1, undefined, {struct, {'thrift_test_types', 'EmptyStruct'}}, field, #'EmptyStruct'{}}
]},
- thrift_test_types:struct_info_ext('thrift.test.OneField')
+ thrift_test_types:struct_info_ext('OneField')
)},
{"VersioningTestV1 definition", ?_assertEqual(
{struct, [
@@ -250,7 +250,7 @@
{3, undefined, string, old_string, undefined},
{12, undefined, i32, end_in_both, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.VersioningTestV1')
+ thrift_test_types:struct_info_ext('VersioningTestV1')
)},
{"VersioningTestV2 definition", ?_assertEqual(
{struct, [
@@ -260,61 +260,61 @@
{4, undefined, i16, newshort, undefined},
{5, undefined, i64, newlong, undefined},
{6, undefined, double, newdouble, undefined},
- {7, undefined, {struct, {thrift_test_types, 'thrift.test.Bonk'}}, newstruct, #'thrift.test.Bonk'{}},
+ {7, undefined, {struct, {thrift_test_types, 'Bonk'}}, newstruct, #'Bonk'{}},
{8, undefined, {list, i32}, newlist, []},
{9, undefined, {set, i32}, newset, sets:new()},
{10, undefined, {map, i32, i32}, newmap, dict:new()},
{11, undefined, string, newstring, undefined},
{12, undefined, i32, end_in_both, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.VersioningTestV2')
+ thrift_test_types:struct_info_ext('VersioningTestV2')
)},
{"ListTypeVersioningV1 definition", ?_assertEqual(
{struct, [
{1, undefined, {list, i32}, myints, []},
{2, undefined, string, hello, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.ListTypeVersioningV1')
+ thrift_test_types:struct_info_ext('ListTypeVersioningV1')
)},
{"ListTypeVersioningV2 definition", ?_assertEqual(
{struct, [
{1, undefined, {list, string}, strings, []},
{2, undefined, string, hello, undefined}
]},
- thrift_test_types:struct_info_ext('thrift.test.ListTypeVersioningV2')
+ thrift_test_types:struct_info_ext('ListTypeVersioningV2')
)},
{"GuessProtocolStruct definition", ?_assertEqual(
{struct, [
{7, undefined, {map, string, string}, map_field, dict:new()}
]},
- thrift_test_types:struct_info_ext('thrift.test.GuessProtocolStruct')
+ thrift_test_types:struct_info_ext('GuessProtocolStruct')
)},
{"LargeDeltas definition", ?_assertEqual(
{struct, [
- {1, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b1, #'thrift.test.Bools'{}},
- {10, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b10, #'thrift.test.Bools'{}},
- {100, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b100, #'thrift.test.Bools'{}},
+ {1, undefined, {struct, {thrift_test_types, 'Bools'}}, b1, #'Bools'{}},
+ {10, undefined, {struct, {thrift_test_types, 'Bools'}}, b10, #'Bools'{}},
+ {100, undefined, {struct, {thrift_test_types, 'Bools'}}, b100, #'Bools'{}},
{500, undefined, bool, check_true, undefined},
- {1000, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b1000, #'thrift.test.Bools'{}},
+ {1000, undefined, {struct, {thrift_test_types, 'Bools'}}, b1000, #'Bools'{}},
{1500, undefined, bool, check_false, undefined},
- {2000, undefined, {struct, {thrift_test_types, 'thrift.test.VersioningTestV2'}}, vertwo2000, #'thrift.test.VersioningTestV2'{}},
+ {2000, undefined, {struct, {thrift_test_types, 'VersioningTestV2'}}, vertwo2000, #'VersioningTestV2'{}},
{2500, undefined, {set, string}, a_set2500, sets:new()},
- {3000, undefined, {struct, {thrift_test_types, 'thrift.test.VersioningTestV2'}}, vertwo3000, #'thrift.test.VersioningTestV2'{}},
+ {3000, undefined, {struct, {thrift_test_types, 'VersioningTestV2'}}, vertwo3000, #'VersioningTestV2'{}},
{4000, undefined, {list, i32}, big_numbers, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.LargeDeltas')
+ thrift_test_types:struct_info_ext('LargeDeltas')
)},
{"NestedListsI32x2 definition", ?_assertEqual(
{struct, [
{1, undefined, {list, {list, i32}}, integerlist, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.NestedListsI32x2')
+ thrift_test_types:struct_info_ext('NestedListsI32x2')
)},
{"NestedListsI32x3 definition", ?_assertEqual(
{struct, [
{1, undefined, {list, {list, {list, i32}}}, integerlist, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.NestedListsI32x3')
+ thrift_test_types:struct_info_ext('NestedListsI32x3')
)},
{"NestedMixedx2 definition", ?_assertEqual(
{struct, [
@@ -322,37 +322,37 @@
{2, undefined, {map, i32, {set, string}}, map_int_strset, dict:new()},
{3, undefined, {list, {map, i32, {set, string}}}, map_int_strset_list, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.NestedMixedx2')
+ thrift_test_types:struct_info_ext('NestedMixedx2')
)},
{"ListBonks definition", ?_assertEqual(
{struct, [
- {1, undefined, {list, {struct, {thrift_test_types, 'thrift.test.Bonk'}}}, bonk, []}
+ {1, undefined, {list, {struct, {thrift_test_types, 'Bonk'}}}, bonk, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.ListBonks')
+ thrift_test_types:struct_info_ext('ListBonks')
)},
{"NestedListsBonk definition", ?_assertEqual(
{struct, [
- {1, undefined, {list, {list, {list, {struct, {thrift_test_types, 'thrift.test.Bonk'}}}}}, bonk, []}
+ {1, undefined, {list, {list, {list, {struct, {thrift_test_types, 'Bonk'}}}}}, bonk, []}
]},
- thrift_test_types:struct_info_ext('thrift.test.NestedListsBonk')
+ thrift_test_types:struct_info_ext('NestedListsBonk')
)},
{"BoolTest definition", ?_assertEqual(
{struct, [
{1, optional, bool, b, true},
{2, optional, string, s, "true"}
]},
- thrift_test_types:struct_info_ext('thrift.test.BoolTest')
+ thrift_test_types:struct_info_ext('BoolTest')
)},
{"StructA definition", ?_assertEqual(
{struct, [{1, required, string, s, undefined}]},
- thrift_test_types:struct_info_ext('thrift.test.StructA')
+ thrift_test_types:struct_info_ext('StructA')
)},
{"StructB definition", ?_assertEqual(
{struct, [
- {1, optional, {struct, {thrift_test_types, 'thrift.test.StructA'}}, aa, #'thrift.test.StructA'{}},
- {2, required, {struct, {thrift_test_types, 'thrift.test.StructA'}}, ab, #'thrift.test.StructA'{}}
+ {1, optional, {struct, {thrift_test_types, 'StructA'}}, aa, #'StructA'{}},
+ {2, required, {struct, {thrift_test_types, 'StructA'}}, ab, #'StructA'{}}
]},
- thrift_test_types:struct_info_ext('thrift.test.StructB')
+ thrift_test_types:struct_info_ext('StructB')
)}
].
@@ -432,12 +432,12 @@
)},
{"testStruct params", ?_assertEqual(
{struct, [
- {1, {struct, {thrift_test_types, 'thrift.test.Xtruct'}}}
+ {1, {struct, {thrift_test_types, 'Xtruct'}}}
]},
thrift_test_thrift:function_info(testStruct, params_type)
)},
{"testStruct reply", ?_assertEqual(
- {struct, {thrift_test_types, 'thrift.test.Xtruct'}},
+ {struct, {thrift_test_types, 'Xtruct'}},
thrift_test_thrift:function_info(testStruct, reply_type)
)},
{"testStruct exceptions", ?_assertEqual(
@@ -446,12 +446,12 @@
)},
{"testNest params", ?_assertEqual(
{struct, [
- {1, {struct, {thrift_test_types, 'thrift.test.Xtruct2'}}}
+ {1, {struct, {thrift_test_types, 'Xtruct2'}}}
]},
thrift_test_thrift:function_info(testNest, params_type)
)},
{"testNest reply", ?_assertEqual(
- {struct, {thrift_test_types, 'thrift.test.Xtruct2'}},
+ {struct, {thrift_test_types, 'Xtruct2'}},
thrift_test_thrift:function_info(testNest, reply_type)
)},
{"testNest exceptions", ?_assertEqual(
@@ -556,12 +556,12 @@
)},
{"testInsanity params", ?_assertEqual(
{struct, [
- {1, {struct, {thrift_test_types, 'thrift.test.Insanity'}}}
+ {1, {struct, {thrift_test_types, 'Insanity'}}}
]},
thrift_test_thrift:function_info(testInsanity, params_type)
)},
{"testInsanity reply", ?_assertEqual(
- {map, i64, {map, i32, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}}},
+ {map, i64, {map, i32, {struct, {'thrift_test_types', 'Insanity'}}}},
thrift_test_thrift:function_info(testInsanity, reply_type)
)},
{"testInsanity exceptions", ?_assertEqual(
@@ -580,7 +580,7 @@
thrift_test_thrift:function_info(testMulti, params_type)
)},
{"testMulti reply", ?_assertEqual(
- {struct, {thrift_test_types, 'thrift.test.Xtruct'}},
+ {struct, {thrift_test_types, 'Xtruct'}},
thrift_test_thrift:function_info(testMulti, reply_type)
)},
{"testMulti exceptions", ?_assertEqual(
@@ -597,7 +597,7 @@
)},
{"testException exceptions", ?_assertEqual(
{struct, [
- {1, {struct, {thrift_test_types, 'thrift.test.Xception'}}}
+ {1, {struct, {thrift_test_types, 'Xception'}}}
]},
thrift_test_thrift:function_info(testException, exceptions)
)},
@@ -606,13 +606,13 @@
thrift_test_thrift:function_info(testMultiException, params_type)
)},
{"testMultiException reply", ?_assertEqual(
- {struct, {thrift_test_types, 'thrift.test.Xtruct'}},
+ {struct, {thrift_test_types, 'Xtruct'}},
thrift_test_thrift:function_info(testMultiException, reply_type)
)},
{"testMultiException exceptions", ?_assertEqual(
{struct, [
- {1, {struct, {thrift_test_types, 'thrift.test.Xception'}}},
- {2, {struct, {thrift_test_types, 'thrift.test.Xception2'}}}
+ {1, {struct, {thrift_test_types, 'Xception'}}},
+ {2, {struct, {thrift_test_types, 'Xception2'}}}
]},
thrift_test_thrift:function_info(testMultiException, exceptions)
)},
diff --git a/test/erl/src/test_client.erl b/test/erl/src/test_client.erl
index 50ffc64..f97bc8a 100644
--- a/test/erl/src/test_client.erl
+++ b/test/erl/src/test_client.erl
@@ -68,13 +68,13 @@
{ok, Client0} = thrift_client_util:new(
"127.0.0.1", Port, thrift_test_thrift, ClientOpts),
- DemoXtruct = #'thrift.test.Xtruct'{
- string_thing = <<"Zero">>,
- byte_thing = 1,
- i32_thing = 9128361,
- i64_thing = 9223372036854775807},
+ DemoXtruct = #'Xtruct'{
+ string_thing = <<"Zero">>,
+ byte_thing = 1,
+ i32_thing = 9128361,
+ i64_thing = 9223372036854775807},
- DemoNest = #'thrift.test.Xtruct2'{
+ DemoNest = #'Xtruct2'{
byte_thing = 7,
struct_thing = DemoXtruct,
% Note that we don't set i32_thing, it will come back as undefined
@@ -86,9 +86,9 @@
DemoDict = dict:from_list([ {Key, Key-10} || Key <- lists:seq(0,10) ]),
DemoSet = sets:from_list([ Key || Key <- lists:seq(-3,3) ]),
- DemoInsane = #'thrift.test.Insanity'{
+ DemoInsane = #'Insanity'{
userMap = dict:from_list([{?THRIFT_TEST_NUMBERZ_FIVE, 5000}]),
- xtructs = [#'thrift.test.Xtruct'{ string_thing = <<"Truck">>, byte_thing = 8, i32_thing = 8, i64_thing = 8}]},
+ xtructs = [#'Xtruct'{ string_thing = <<"Truck">>, byte_thing = 8, i32_thing = 8, i64_thing = 8}]},
error_logger:info_msg("testVoid"),
{Client01, {ok, ok}} = thrift_client:call(Client0, testVoid, []),
@@ -126,7 +126,7 @@
{Client16, {ok, InsaneResult}} = thrift_client:call(Client15, testInsanity, [DemoInsane]),
io:format("~p~n", [InsaneResult]),
- {Client17, {ok, #'thrift.test.Xtruct'{string_thing = <<"Message">>}}} =
+ {Client17, {ok, #'Xtruct'{string_thing = <<"Message">>}}} =
thrift_client:call(Client16, testMultiException, ["Safe", "Message"]),
Client18 =
@@ -135,10 +135,10 @@
io:format("Unexpected return! ~p~n", [Result1]),
ClientS1
catch
- throw:{ClientS2, {exception, ExnS1 = #'thrift.test.Xception'{}}} ->
- #'thrift.test.Xception'{errorCode = 1001, message = <<"This is an Xception">>} = ExnS1,
+ throw:{ClientS2, {exception, ExnS1 = #'Xception'{}}} ->
+ #'Xception'{errorCode = 1001, message = <<"This is an Xception">>} = ExnS1,
ClientS2;
- throw:{ClientS2, {exception, _ExnS1 = #'thrift.test.Xception2'{}}} ->
+ throw:{ClientS2, {exception, _ExnS1 = #'Xception2'{}}} ->
io:format("Wrong exception type!~n", []),
ClientS2
end,
@@ -149,12 +149,12 @@
io:format("Unexpected return! ~p~n", [Result2]),
ClientS3
catch
- throw:{ClientS4, {exception, _ExnS2 = #'thrift.test.Xception'{}}} ->
+ throw:{ClientS4, {exception, _ExnS2 = #'Xception'{}}} ->
io:format("Wrong exception type!~n", []),
ClientS4;
- throw:{ClientS4, {exception, ExnS2 = #'thrift.test.Xception2'{}}} ->
- #'thrift.test.Xception2'{errorCode = 2002,
- struct_thing = #'thrift.test.Xtruct'{
+ throw:{ClientS4, {exception, ExnS2 = #'Xception2'{}}} ->
+ #'Xception2'{errorCode = 2002,
+ struct_thing = #'Xtruct'{
string_thing = <<"This is an Xception2">>}} = ExnS2,
ClientS4
end,
diff --git a/test/erl/src/test_thrift_server.erl b/test/erl/src/test_thrift_server.erl
index f3ed2f7..f504c73 100644
--- a/test/erl/src/test_thrift_server.erl
+++ b/test/erl/src/test_thrift_server.erl
@@ -107,10 +107,10 @@
{reply, S};
handle_function(testStruct,
- {Struct = #'thrift.test.Xtruct'{string_thing = String,
- byte_thing = Byte,
- i32_thing = I32,
- i64_thing = I64}})
+ {Struct = #'Xtruct'{string_thing = String,
+ byte_thing = Byte,
+ i32_thing = I32,
+ i64_thing = I64}})
when is_binary(String),
is_integer(Byte),
is_integer(I32),
@@ -119,8 +119,8 @@
{reply, Struct};
handle_function(testNest,
- {Nest}) when is_record(Nest, 'thrift.test.Xtruct2'),
- is_record(Nest#'thrift.test.Xtruct2'.struct_thing, 'thrift.test.Xtruct') ->
+ {Nest}) when is_record(Nest, 'Xtruct2'),
+ is_record(Nest#'Xtruct2'.struct_thing, 'Xtruct') ->
io:format("testNest: ~p~n", [Nest]),
{reply, Nest};
@@ -159,22 +159,22 @@
{-4, dict:from_list(NegList)}]),
{reply, MapMap};
-handle_function(testInsanity, {Insanity}) when is_record(Insanity, 'thrift.test.Insanity') ->
- Hello = #'thrift.test.Xtruct'{string_thing = <<"Hello2">>,
- byte_thing = 2,
- i32_thing = 2,
- i64_thing = 2},
+handle_function(testInsanity, {Insanity}) when is_record(Insanity, 'Insanity') ->
+ Hello = #'Xtruct'{string_thing = <<"Hello2">>,
+ byte_thing = 2,
+ i32_thing = 2,
+ i64_thing = 2},
- Goodbye = #'thrift.test.Xtruct'{string_thing = <<"Goodbye4">>,
- byte_thing = 4,
- i32_thing = 4,
- i64_thing = 4},
- Crazy = #'thrift.test.Insanity'{
- userMap = dict:from_list([{?THRIFT_TEST_NUMBERZ_EIGHT, 8}]),
- xtructs = [Goodbye]
- },
+ Goodbye = #'Xtruct'{string_thing = <<"Goodbye4">>,
+ byte_thing = 4,
+ i32_thing = 4,
+ i64_thing = 4},
+ Crazy = #'Insanity'{
+ userMap = dict:from_list([{?THRIFT_TEST_NUMBERZ_EIGHT, 8}]),
+ xtructs = [Goodbye]
+ },
- Looney = #'thrift.test.Insanity'{},
+ Looney = #'Insanity'{},
FirstMap = dict:from_list([{?THRIFT_TEST_NUMBERZ_TWO, Insanity},
{?THRIFT_TEST_NUMBERZ_THREE, Insanity}]),
@@ -196,16 +196,16 @@
is_integer(Arg5) ->
io:format("testMulti(~p)~n", [Args]),
- {reply, #'thrift.test.Xtruct'{string_thing = <<"Hello2">>,
- byte_thing = Arg0,
- i32_thing = Arg1,
- i64_thing = Arg2}};
+ {reply, #'Xtruct'{string_thing = <<"Hello2">>,
+ byte_thing = Arg0,
+ i32_thing = Arg1,
+ i64_thing = Arg2}};
handle_function(testException, {String}) when is_binary(String) ->
io:format("testException(~p)~n", [String]),
case String of
<<"Xception">> ->
- throw(#'thrift.test.Xception'{errorCode = 1001,
+ throw(#'Xception'{errorCode = 1001,
message = String});
<<"TException">> ->
throw({?TApplicationException_Structure});
@@ -217,14 +217,14 @@
io:format("testMultiException(~p, ~p)~n", [Arg0, Arg1]),
case Arg0 of
<<"Xception">> ->
- throw(#'thrift.test.Xception'{errorCode = 1001,
+ throw(#'Xception'{errorCode = 1001,
message = <<"This is an Xception">>});
<<"Xception2">> ->
- throw(#'thrift.test.Xception2'{errorCode = 2002,
+ throw(#'Xception2'{errorCode = 2002,
struct_thing =
- #'thrift.test.Xtruct'{string_thing = <<"This is an Xception2">>}});
+ #'Xtruct'{string_thing = <<"This is an Xception2">>}});
_ ->
- {reply, #'thrift.test.Xtruct'{string_thing = Arg1}}
+ {reply, #'Xtruct'{string_thing = Arg1}}
end;
handle_function(testOneway, {Seconds}) ->