Skip to content

[pigeon] Java Result<T> doesn't allow communicating nullability #124268

@stuartmorgan-g

Description

@stuartmorgan-g

As far as I can tell there's no way to pass nullability annotations through a generic in Java. To allow for expressing nullability of return values, we should make a breaking change to add a new NullableResult<T>, which is the same as Result<T> except for the annotations we put on the argument to success. (The breaking part being that some methods that currently have a Result parameter will change to a NullableResult parameter.)

For now I'm suppressing the UnknownNullability warning on Result<T>'s success method.

@tarrinneal I think we should do this at the same time we replace Reply with Result for #118243 since we'll be making a related breaking change for Java at that point (although this one will affect more code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listp: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions