Skip to content

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

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

Activity

  1. added
    p: pigeonrelated to pigeon messaging codegen tool
    on Sep 24, 2020
  2. github-actions commented on Aug 5, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  3. locked as resolved and limited conversation to collaborators on Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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