Skip to content

stub: Possible always-false condition in BlockingClientCall #12425

@becomeStar

Description

@becomeStar

Hello, I’m interested in the grpc-java project and have been analyzing its pull requests.
While reviewing PR #12259, I noticed that a condition in an if statement appears to be always false. The relevant line is below (line 228 in the BlockingClientCall class):

if (savedCloseState == null || savedCloseState.status == null)

In this if clause, savedCloseState.status seems to always be non-null, because of the following check in the CloseState constructor:

CloseState(Status status, Metadata trailers) {
    this.status = Preconditions.checkNotNull(status, "status");
    this.trailers = trailers;
}

Given this, I was wondering whether it would make sense to remove the savedCloseState.status == null condition to simplify the code:

if (savedCloseState == null)

Is this condition intentional, or would a cleanup PR in this area be acceptable?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions