generic method to create an instance from an object
<p>Is this a safe way to create an instance (assuming T has a accessible default constructor) ?</p>

<pre><code>&lt;T&gt;
public T defaultObj(T obj) throws Exception {
    return (T) obj.getClass().newInstance();
}
</code></pre>

<p>Because of the type erasure, the above codes will generate an unchecked warning.  Is it possible to get rid of this warning other than @SuppressWarnings?</p>

<p>Many thanks in advance!</p>

<p><strong>Edit:</strong>
Yes, I know if I could pass a <code>class&lt;T&gt; type</code> which would be much better.  But let's just assume it is out of question for now.</p>
