Why isn't Array.newInstance(Class<?>, int) generic?
<p>I mean, is there any good reason for that? The <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Array.html#newInstance(java.lang.Class,%20int)">method</a>'s got the following signature:</p>

<pre><code>public static Object newInstance(Class&lt;?&gt; componentType,
                 int length)
                          throws NegativeArraySizeException
</code></pre>

<p>In my opinion, it would be much more convinient to declare the method as follows:</p>

<pre><code>public static &lt;T&gt; T[] newInstance(Class&lt;T&gt; componentType, int length) 
                                          throws NegativeArraySizeException
</code></pre>

<p>That way, when creating an aray of generic type it would not be neccesary to perform additional casting, e.g.</p>

<pre><code>public class Gen&lt;T&gt;{
    private T[] a;

    public static &lt;T&gt; Gen&lt;T&gt; createByClass(Class&lt;T&gt; clazz){
        a = clazz.cast(Array.newIntance(clazz.getComponentType(), 8); //we have to invoke 
                                                                      //clazz.cast here.
    }
}
</code></pre>

<p>Was there any good reason to declare the return value type as <code>Object</code>? To me it seems very incovinient.</p>