jsweet
jsweet copied to clipboard
Method generic type isn't inferred
public class ThingA {
public static <T> HashSet<T> x() {
return new HashSet<>();
}
public static void y(HashSet<String> arg) {}
public static void main(String[] args) {
y(x());
}
}
I think Java infers types 1 level deep from call parameters. This should produce ThingA.x<String>()
but instead I get:
namespace jsweettest.moda {
export class ThingA {
public static x<T>() : java.util.HashSet<T> {
return <any>(new java.util.HashSet<any>());
}
public static y(arg : java.util.HashSet<string>) {
}
public static main(args : string[]) {
ThingA.y(ThingA.x<any>());
}
}
ThingA["__class"] = "jsweettest.moda.ThingA";
}