The problem arises because the method signature has variable arguments. When a method is called, there are three phases during which a search is made for all applicable methods. Methods with variable arguments are executed in phase 3 , where boxing and unpacking are also allowed.
So both xor(boolean...) and xor(boolean...) applicable here because boxing is taken into account. When multiple methods are applied, only the most specific is called. But in this case, boolean and boolean cannot be compared, therefore there is no more specific method, therefore a compiler error: both methods correspond.
The workaround is to create an explicit array:
public static void main(String[] args) { xor(new boolean[] { true, false });
source share