diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2016-06-21 08:25:28 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-21 08:25:28 -0400 |
commit | a230b5d20949d9ba5b31f4d762ae88af4c5ee8f5 (patch) | |
tree | c23ee0a40e93ac514c48413b6b0c3129a28aec97 /objectivec/Tests/GPBMessageTests.m | |
parent | 1a5333b8c176df60a30d8dce77bb35abdabff905 (diff) | |
download | protobuf-a230b5d20949d9ba5b31f4d762ae88af4c5ee8f5.tar.gz protobuf-a230b5d20949d9ba5b31f4d762ae88af4c5ee8f5.tar.bz2 protobuf-a230b5d20949d9ba5b31f4d762ae88af4c5ee8f5.zip |
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/GPBMessageTests.m')
-rw-r--r-- | objectivec/Tests/GPBMessageTests.m | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/objectivec/Tests/GPBMessageTests.m b/objectivec/Tests/GPBMessageTests.m index 89d1fce2..a3c5a6b4 100644 --- a/objectivec/Tests/GPBMessageTests.m +++ b/objectivec/Tests/GPBMessageTests.m @@ -1171,7 +1171,7 @@ XCTAssertFalse([message2.a hasA]); // But adding an element to the map should. - [message.a.a.iToI setValue:100 forKey:200]; + [message.a.a.iToI setInt32:100 forKey:200]; XCTAssertTrue([message hasA]); XCTAssertTrue([message.a hasA]); XCTAssertEqual([message.a.a.iToI count], (NSUInteger)1); @@ -1190,7 +1190,7 @@ message1a.a.iToI = message1b.a.iToI; XCTAssertTrue([message1a hasA]); XCTAssertFalse([message1b hasA]); - [message1a.a.iToI setValue:1 forKey:2]; + [message1a.a.iToI setInt32:1 forKey:2]; XCTAssertTrue([message1a hasA]); XCTAssertTrue([message1b hasA]); XCTAssertEqual(message1a.a.iToI, message1b.a.iToI); @@ -1224,7 +1224,7 @@ // with different objects that are equal). TestRecursiveMessageWithRepeatedField *message3 = [TestRecursiveMessageWithRepeatedField message]; - message3.iToI = [GPBInt32Int32Dictionary dictionaryWithValue:10 forKey:20]; + message3.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:10 forKey:20]; message3.strToStr = [NSMutableDictionary dictionaryWithObject:@"abc" forKey:@"123"]; XCTAssertNotNil(message.iToI); @@ -1292,7 +1292,7 @@ XCTAssertFalse([message hasA]); GPBInt32Int32Dictionary *iToI = [message.a.iToI retain]; XCTAssertEqual(iToI->_autocreator, message.a); // Pointer comparision - message.a.iToI = [GPBInt32Int32Dictionary dictionaryWithValue:6 forKey:7]; + message.a.iToI = [GPBInt32Int32Dictionary dictionaryWithInt32:6 forKey:7]; XCTAssertTrue([message hasA]); XCTAssertNotEqual(message.a.iToI, iToI); // Pointer comparision XCTAssertNil(iToI->_autocreator); |