aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/Tests/GPBTestUtilities.m
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2016-06-21 08:25:28 -0400
committerGravatar GitHub <noreply@github.com>2016-06-21 08:25:28 -0400
commita230b5d20949d9ba5b31f4d762ae88af4c5ee8f5 (patch)
treec23ee0a40e93ac514c48413b6b0c3129a28aec97 /objectivec/Tests/GPBTestUtilities.m
parent1a5333b8c176df60a30d8dce77bb35abdabff905 (diff)
Rename methods to avoid ObjC KVC collisions. (#1699)
Note: Breaking API change on the Dictionary classes. The numeric value classes were using "Value" in the naming, but this silently collided with the KVC category on NSObject; meaning KVC code could break up a keypath and call these selectors with the wrong types leading to crashes (even though the code all would compile cleanly). - Rename the methods to use the "type" instead of literal "Value". - Update all the impls and tests. - Enable the warning that will catch issues like this in the future. Fixes https://github.com/google/protobuf/issues/1616
Diffstat (limited to 'objectivec/Tests/GPBTestUtilities.m')
-rw-r--r--objectivec/Tests/GPBTestUtilities.m30
1 files changed, 15 insertions, 15 deletions
diff --git a/objectivec/Tests/GPBTestUtilities.m b/objectivec/Tests/GPBTestUtilities.m
index 726761a7..ebccaac9 100644
--- a/objectivec/Tests/GPBTestUtilities.m
+++ b/objectivec/Tests/GPBTestUtilities.m
@@ -1089,19 +1089,19 @@ const uint32_t kGPBDefaultRepeatCount = 2;
- (void)setAllMapFields:(TestMap *)message numEntries:(uint32_t)count {
for (uint32_t i = 0; i < count; i++) {
- [message.mapInt32Int32 setValue:(i + 1) forKey:100 + i * 100];
- [message.mapInt64Int64 setValue:(i + 1) forKey:101 + i * 100];
- [message.mapUint32Uint32 setValue:(i + 1) forKey:102 + i * 100];
- [message.mapUint64Uint64 setValue:(i + 1) forKey:103 + i * 100];
- [message.mapSint32Sint32 setValue:(i + 1) forKey:104 + i * 100];
- [message.mapSint64Sint64 setValue:(i + 1) forKey:105 + i * 100];
- [message.mapFixed32Fixed32 setValue:(i + 1) forKey:106 + i * 100];
- [message.mapFixed64Fixed64 setValue:(i + 1) forKey:107 + i * 100];
- [message.mapSfixed32Sfixed32 setValue:(i + 1) forKey:108 + i * 100];
- [message.mapSfixed64Sfixed64 setValue:(i + 1) forKey:109 + i * 100];
- [message.mapInt32Float setValue:(i + 1) forKey:110 + i * 100];
- [message.mapInt32Double setValue:(i + 1) forKey:111 + i * 100];
- [message.mapBoolBool setValue:((i % 2) == 1) forKey:((i % 2) == 0)];
+ [message.mapInt32Int32 setInt32:(i + 1) forKey:100 + i * 100];
+ [message.mapInt64Int64 setInt64:(i + 1) forKey:101 + i * 100];
+ [message.mapUint32Uint32 setUInt32:(i + 1) forKey:102 + i * 100];
+ [message.mapUint64Uint64 setUInt64:(i + 1) forKey:103 + i * 100];
+ [message.mapSint32Sint32 setInt32:(i + 1) forKey:104 + i * 100];
+ [message.mapSint64Sint64 setInt64:(i + 1) forKey:105 + i * 100];
+ [message.mapFixed32Fixed32 setUInt32:(i + 1) forKey:106 + i * 100];
+ [message.mapFixed64Fixed64 setUInt64:(i + 1) forKey:107 + i * 100];
+ [message.mapSfixed32Sfixed32 setInt32:(i + 1) forKey:108 + i * 100];
+ [message.mapSfixed64Sfixed64 setInt64:(i + 1) forKey:109 + i * 100];
+ [message.mapInt32Float setFloat:(i + 1) forKey:110 + i * 100];
+ [message.mapInt32Double setDouble:(i + 1) forKey:111 + i * 100];
+ [message.mapBoolBool setBool:((i % 2) == 1) forKey:((i % 2) == 0)];
NSString *keyStr = [[NSString alloc] initWithFormat:@"%d", 112 + i * 100];
NSString *dataStr = [[NSString alloc] initWithFormat:@"%d", i + 1];
@@ -1114,8 +1114,8 @@ const uint32_t kGPBDefaultRepeatCount = 2;
[data release];
[message.mapInt32Enum
- setValue:(i % 2) ? MapEnum_MapEnumBar : MapEnum_MapEnumBaz
- forKey:114 + i * 100];
+ setEnum:(i % 2) ? MapEnum_MapEnumBar : MapEnum_MapEnumBaz
+ forKey:114 + i * 100];
ForeignMessage *subMsg = [[ForeignMessage alloc] init];
subMsg.c = i + 1;