bbaldino
12/10/2021, 10:18 PMclass Foo {
public static Foo.Builder Builder() { ... }
public static class Builder {
public Builder() { ... }
}
}
and i’m trying to call it from kotlin like:
Foo.Builder()
...
but i get complaints about ambiguity…i think because the helper type in Foo
matches the class name (and therefore the constructor) exactly. does anyone know if there’s a way to disambiguate between the two from kotlin?Ruckus
12/10/2021, 10:20 PMbbaldino
12/10/2021, 10:21 PMRuckus
12/10/2021, 10:21 PMbbaldino
12/10/2021, 10:21 PMephemient
12/10/2021, 10:22 PMFoo.Builder::class
but that doesn't really helpbbaldino
12/10/2021, 10:22 PMephemient
12/10/2021, 10:22 PMnew
keyword to call the constructor while Kotlin treats them all as callables in the same namespacebbaldino
12/10/2021, 10:23 PMephemient
12/10/2021, 10:23 PMFoo.Builder::class.createInstance()
Foo::class.declaredFunctions.single { it.name == "Builder" }.call() as Foo.Builder
bbaldino
12/10/2021, 10:24 PMcreateInstance
is probably workableFoo
class has generics, so I can’t use ::class
😕