Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SDL-0005] Immutable RPC collections #508

Merged
merged 5 commits into from
Jan 24, 2017

Conversation

joeljfischer
Copy link
Contributor

Fixes #507

This PR is ready for review.

Risk

This PR makes major API changes.

Testing Plan

All tests continue to pass.

Summary

This PR changes RPC properties that are currently NSMutableArrays to be NSArrays instead, and updates breaking code. Note that passing a mutable array to an immutable array parameter is still valid, therefore, some code will not break for end users. However, assigning an immutable array to a mutable variable is an error, and so some code will break.

Changelog

Breaking Changes
  • RPC parameters previously marked NSMutableArray are now NSArray instead.

@joeljfischer joeljfischer added enhancement proposal Accepted SDL Evolution Proposal labels Jan 20, 2017
@joeljfischer joeljfischer added this to the 5.0.0 milestone Jan 20, 2017
@joeljfischer joeljfischer requested a review from asm09fsu January 20, 2017 15:02
@joeljfischer joeljfischer changed the title Feature/sdl 0005 immutable rpc collections Immutable RPC collections Jan 20, 2017
@joeljfischer joeljfischer changed the title Immutable RPC collections [SDL-0005] Immutable RPC collections Jan 20, 2017
@codecov-io
Copy link

codecov-io commented Jan 20, 2017

Current coverage is 9.95% (diff: 10.52%)

No coverage report found for develop at 36dc4c2.

Powered by Codecov. Last update 36dc4c2...b8fb408

Copy link
Contributor

@asm09fsu asm09fsu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If sdl_enumsForName: just does sdl_objectForName:, should we remove that function and just use sdl_objectForName:?

NSMutableArray *newList = [NSMutableArray arrayWithCapacity:[array count]];
for (NSDictionary<NSString *, id> *dict in array) {
[newList addObject:[[classType alloc] initWithDictionary:dict]];
}
return newList;
return [NSArray arrayWithArray:newList];
Copy link
Contributor

@asm09fsu asm09fsu Jan 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do [newList copy]; instead because copy makes immutable properties.

}
return newList;
}
- (NSArray<SDLEnum> *)sdl_enumsForName:(SDLName)name {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If sdl_enumsForName: just does sdl_objectForName:, should we remove that function and just use sdl_objectForName:?

* Remove a helper method that’s not needed
@joeljfischer
Copy link
Contributor Author

@asm09fsu Ready for another review

@joeljfischer joeljfischer merged commit c1ba083 into develop Jan 24, 2017
@joeljfischer joeljfischer deleted the feature/sdl_0005_immutable_rpc_collections branch January 24, 2017 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Accepted SDL Evolution Proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants