Skip to content

Commit 49254e7

Browse files
Removed NSDictionary generics for now.
1 parent 02b7450 commit 49254e7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

bro-gen.rb

+8-9
Original file line numberDiff line numberDiff line change
@@ -833,13 +833,12 @@ def generate_template_data(data)
833833

834834
def append_marshalers(lines)
835835
dict_type = is_foundation? ? "NSDictionary" : "CFDictionary"
836-
dict_generics = is_foundation? ? "<NSString, NSObject>" : ""
837836
base_type = is_foundation? ? "NSObject" : "CFType"
838837

839838
lines << "public static class Marshaler {"
840839
lines << " @MarshalsPointer"
841840
lines << " public static #{@name} toObject(Class<#{@name}> cls, long handle, long flags) {"
842-
lines << " #{dict_type}#{dict_generics} o = (#{dict_type}#{dict_generics}) #{base_type}.Marshaler.toObject(#{dict_type}.class, handle, flags);"
841+
lines << " #{dict_type} o = (#{dict_type}) #{base_type}.Marshaler.toObject(#{dict_type}.class, handle, flags);"
843842
lines << " if (o == null) {"
844843
lines << " return null;"
845844
lines << " }"
@@ -854,7 +853,7 @@ def append_marshalers(lines)
854853
lines << " }"
855854
lines << "}"
856855

857-
array_type = is_foundation? ? "NSArray<#{dict_type}#{dict_generics}>" : "CFArray"
856+
array_type = is_foundation? ? "NSArray<#{dict_type}>" : "CFArray"
858857
array_class = is_foundation? ? "NSArray.class" : "CFArray.class"
859858

860859
lines << "public static class AsListMarshaler {"
@@ -876,7 +875,7 @@ def append_marshalers(lines)
876875
lines << " if (l == null) {"
877876
lines << " return 0L;"
878877
lines << " }"
879-
lines << " NSArray<NSDictionary<NSString, NSObject>> array = new NSMutableArray<>();" if is_foundation?
878+
lines << " NSArray<NSDictionary> array = new NSMutableArray<>();" if is_foundation?
880879
lines << " CFArray array = CFMutableArray.create();" if !is_foundation?
881880
lines << " for (#{@name} i : l) {"
882881
lines << " array.add(i.getDictionary());"
@@ -887,7 +886,7 @@ def append_marshalers(lines)
887886
end
888887

889888
def append_constructors(lines)
890-
dict_type = is_foundation? ? "NSDictionary<NSString, NSObject>" : "CFDictionary"
889+
dict_type = is_foundation? ? "NSDictionary" : "CFDictionary"
891890

892891
constructor_visibility = @constructor_visibility.nil? ? '' : "#{@constructor_visibility} "
893892

@@ -1004,7 +1003,7 @@ def convenience_getter_value(type, type_hint, key_accessor)
10041003
s << "return #{name}.valueOf(val);"
10051004
end
10061005
elsif resolved_type.is_a?(GlobalValueDictionaryWrapper) || type_hint == 'GlobalValueDictionaryWrapper'
1007-
s << "NSDictionary<NSString, NSObject> val = (NSDictionary<NSString, NSObject>) get(#{key_accessor});"
1006+
s << "NSDictionary val = (NSDictionary) get(#{key_accessor});"
10081007
s << "return new #{name}(val);"
10091008
elsif resolved_type.is_a?(Enum)
10101009
s << "NSNumber val = (NSNumber) get(#{key_accessor});"
@@ -1044,8 +1043,8 @@ def convenience_getter_value(type, type_hint, key_accessor)
10441043
generic_type = @model.resolve_type_by_name("#{$1}")
10451044
if generic_type.is_a?(GlobalValueDictionaryWrapper)
10461045
s << "List<#{$1}> list = new ArrayList<>();"
1047-
s << "NSDictionary<NSString, NSObject>[] array = (NSDictionary<NSString, NSObject>[]) val.toArray(new NSDictionary[val.size()]);"
1048-
s << "for (NSDictionary<NSString, NSObject> d : array) {"
1046+
s << "NSDictionary[] array = (NSDictionary[]) val.toArray(new NSDictionary[val.size()]);"
1047+
s << "for (NSDictionary d : array) {"
10491048
s << " list.add(new #{$1}(d));"
10501049
s << "}"
10511050
s << "return list;"
@@ -1173,7 +1172,7 @@ def convenience_setter_value(type, type_hint, param_name)
11731172
generic_type = @model.resolve_type_by_name("#{$1}")
11741173
if generic_type.is_a?(GlobalValueDictionaryWrapper)
11751174
s = []
1176-
s << " NSArray<NSDictionary<NSString, NSObject>> val = new NSMutableArray<>();"
1175+
s << " NSArray<NSDictionary> val = new NSMutableArray<>();"
11771176
s << " for (#{generic_type.name} e : #{param_name}) {"
11781177
s << " val.add(e.getDictionary());"
11791178
s << " }"

0 commit comments

Comments
 (0)