appreciated/apexcharts-flow

SeriesBuilder missing generics parameter

Closed this issue · 1 comments

Describe the bug
Not exactly a bug, but the SeriesBuilder class is pretty much unusable, the static getmethod is the only way of instantiating it but doesn't accept a generic type. Why have the generic type in the first place if you cannot use it?

Steps or code example to Reproduce
The following code will cause a compiler error, since the withData method expects a parameter of type capture of ?... which isn't possible. There is no way to set the generic type of the SeriesBuilder class without using an unsafe cast.

final Series series = SeriesBuilder.get().withData(1.0).build()

The current implementation of the get method is as follows

public static SeriesBuilder<?> get() {
    return new SeriesBuilder();
}

Expected behavior
I'd expect the static get method to have a generic type, changing it to:

public static <T> SeriesBuilder<T> get() {
    return new SeriesBuilder<>();
}

Fixed by #186