javaflow icon indicating copy to clipboard operation
javaflow copied to clipboard

Support type parameters in classes

Open pascalgn opened this issue 6 years ago • 1 comments

The following model is not handled correctly:

public class ModelWithTypeParams {
  class Child<T> {
    private T field;

    public T getField() {
      return field;
    }
  }

  private Child<String> child1;
  private Child<Integer> child2;

  public Child<String> getChild1() {
    return child1;
  }

  public Child<Integer> getChild2() {
    return child2;
  }
}

as I can see, flow supports generics so I think it might be enough if we "simply" generate this:

export type Child<T> = {
  field: T
}

export type ModelWithTypeParams = {
  child1: Child<string>,
  child2: Child<number>
}

But maybe I'm missing something obvious here?

pascalgn avatar Nov 11 '18 15:11 pascalgn

Your proposal seems reasonable :)

havardh avatar Nov 11 '18 17:11 havardh