Now, I've seen many similar questions to this or this before and I understand the answer is "because of erasure". But I don't understand why erasure prevents us creating an array of generics.
As far as I understand; arrays represent a contiguous allocation of memory, containing primitives or references to objects. Unless I'm mistaken, java arrays are little more than C/C++ arrays with a bit of fancy dressing around them. Is this correct?
If so, why does erasure prevent an array being created like this for generic types? Aren't all references the same size, regardless of the type of the class? The class of course would be bigger or smaller, but that shouldn't affect the reference. So wouldn't we know exactly how big the array should be?
Or is it technically possible to do, but some other problem is encountered if we allow generic arrays to be created?
To be clear: I understand what erasure is and how it works. I understand how I can create an array, given the above restrictions. I don't want to do this.
I just want to understand for what reason the type information is required when I create an array.