Skip to content

[pigeon] Use List instead of ArrayList on generated Java pigeon entries #66453

@matejdro

Description

@matejdro

Minor, but useful enhancement.

Currently, following pigeon class:

class Response {
  List<String> details;
}

generates following java version:

  public static class Response {
    private ArrayList details;
    public ArrayList getDetails() { return details; }
    public void setDetails(ArrayList setterArg) { this.details = setterArg; }

    ...
  }

However, from what I see, there is really no reason why details here is specifically ArrayList. It should just be List, which allows developer to pass any kind of list.

Primary use case here are transformation methods, for example Kotlin's list.map {} method which just return ordinary List. At the moment, there is additional overhead of transforming whatever list Kotlin generates into ArrayList.

(This is with Pigeon 0.1.6)

@gaaclarke

Metadata

Metadata

Assignees

No one assigned

    Labels

    p: pigeonrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions