Consider this example of valid code:
class Test {
E[] array;
Test() {
array = (E[]) new Object[100];
}
}
What is the reason that the following isn't allowed?
array = new E[100];
It seems stupid that this isn't allowed because the original code is unelegant and will generate a warning. It is also a needed construction in a lot of containers.
I don't see any reason why the 'new E'-notation shouldn't be allowed. It doesn't create any E objects, so E doesn't have to be a known type.
I've asked my lecturer, but she(!) doesn't have an answer (yet -- she said she'd think about it).