Jetty's BlockingArrayQueue has these two constructors (among a bunch of others):
/**
* Creates an instance with given initial and max capacities.
*
* @param capacity the initial capacity
* @param growBy the growth factor
* @param maxCapacity the maximum capacity
* @deprecated the growth factor isn't used anymore
*/
@Deprecated(since = "12.1.2", forRemoval = true)
public BlockingArrayQueue(int capacity, int growBy, int maxCapacity)
{
this(capacity, maxCapacity, false);
}
/**
* Creates an instance with given initial and max capacities.
*
* @param capacity the initial capacity
* @param maxCapacity the maximum capacity
* @param ignored this parameter is ignored but is needed as there is already a
* {@link BlockingArrayQueue#BlockingArrayQueue(int, int) deprecated constructor} that takes two ints.
*/
private BlockingArrayQueue(int capacity, int maxCapacity, boolean ignored)
{
if (capacity < 0 || maxCapacity < 0 || capacity > maxCapacity)
throw new IllegalArgumentException();
_elements = new Object[capacity];
_maxCapacity = maxCapacity;
}
I'm trying to call the second (the one with the boolean arg in the third position) but the compiler is hell bent on calling the first one.
(BlockingArrayQueue. 10 5 true)
Execution error (ClassCastException) at user/eval7644 (form-init275792826230635171.clj:1).
class java.lang.Boolean cannot be cast to class java.lang.Number (java.lang.Boolean and java.lang.Number are in module java.base of loader 'bootstrap')
(BlockingArrayQueue. 10 5 (boolean true))
Execution error (ClassCastException) at user/eval7648 (form-init275792826230635171.clj:1).
class java.lang.Boolean cannot be cast to class java.lang.Number (java.lang.Boolean and java.lang.Number are in module java.base of loader 'bootstrap')
(BlockingArrayQueue. 10 5 Boolean/TRUE)
Execution error (ClassCastException) at user/eval7652 (form-init275792826230635171.clj:1).
class java.lang.Boolean cannot be cast to class java.lang.Number (java.lang.Boolean and java.lang.Number are in module java.base of loader 'bootstrap')
What am I doing wrong?