Kotlin invokes wrong overloaded java method with variable number of arguments

I have two java methods:

Object get(A a)
Object get(A a, B... b)

and when I’m trying to invoke first method in Kotlin


It always invokes second method with empty second parameter.

How could I call first method from Kotlin in this case?

Can you provide more details/code? It shouldn’t call second method… I tried with same type for A and B but even in this case it calls the correct method.

<T extends Entity<?, ID>, ID extends Comparable> Optional find(GenericId<T, ID> id);

<T extends ModelWithGenericId<?, ID, S, ?>, ID extends Comparable<ID>, S extends State> Optional<T> find(GenericId<T, ID> id, S... states);

Methods in java.

Calling in kotlin from
val id = CustomId() //extended GenericId<T, ID> id