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

Make ConnectivityObserver class final #375

Merged
merged 2 commits into from
Feb 25, 2019

Conversation

rebello95
Copy link
Collaborator

@rebello95 rebello95 commented Feb 23, 2019

This is private to the file and will never be subclassed. I believe updating it with the final annotation will make this clearer to readers.

This is `private` to the file and will never be subclassed.

Also moved the setting of `underlyingCompletionQueue` inline to where it's declared.
@rebello95 rebello95 requested a review from MrMage February 23, 2019 17:36
@@ -132,18 +132,17 @@ public class Channel {
}

private extension Channel {
class ConnectivityObserver {
final class ConnectivityObserver {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given that the containing extension is private already, making the class final won't make a difference to the compiler and it's unlikely that anyone is going to subclass ConnectivityObserver in the same file. However, it won't hurt, either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed that this won't make a difference to the compiler, but I do think it's nice to annotate classes with final by default as opposed to making them subclass-able by default, since it is clearer from the reader's perspective whether something is currently being subclassed (since it could have another subclass elsewhere in the file in this particular example)

Copy link
Collaborator

Choose a reason for hiding this comment

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

That makes sense, thank you for explaining.

Sources/SwiftGRPC/Core/Channel.swift Outdated Show resolved Hide resolved
@MrMage MrMage merged commit 5f24269 into grpc:master Feb 25, 2019
@rebello95 rebello95 deleted the final-connectivity-state branch February 25, 2019 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants