toArray() returns an Object[] [and not any object derived from Object[]]. Each element in this array is of type Class, but the array itself is not of type Class[]
You should cast each element in the array to Class instead of trying to cast the array, or use Collection.toArray(T[]) to avoid casting.