I've been using fastutil for some time and the other day I wanted make some changes in the implementation of ObjectArrayFIFOQueue, and I realized that one of the lines in the constuctor ObjectArrayFIFOQueue(final int capacity) is casting Object[] to K[].
I was under the impression that this is not possible in Java, and when I actually tried to extend the class and make my changes, when I instantiated this subclass I got a ClassCastException, which makes sense to me, but I don't understand why isn't the exception is thrown when I'm using simply ObjectArrayFIFOQueue.
Can you pls enlighten me? Is something happening in the background I'm not aware of?
Thanks!