Migrating from Java 7 to Java 8 - compilation error
<p>The following code compiles both test methods using javac in JDK7 but JDK8 will only compile <code>willCompile</code> method. </p>

<p>The error for <code>willNotcompile</code> is:
"The method <code>method</code>(<code>Class&lt;T&gt;</code>) in the type <code>Klasa</code> is not applicable for the arguments (<code>Class</code>)."</p>

<pre><code>@Test
public void willCompile() throws InstantiationException, IllegalAccessException {
    Class klass = getObject(Class.class);
    method(klass);
}

@Test
public void willNotCompile() throws InstantiationException, IllegalAccessException {
    method(getObject(Class.class));
}

&lt;T&gt; ResponseEntity&lt;T&gt; method (Class&lt;T&gt; klasa) {
    return new ResponseEntity&lt;T&gt;(HttpStatus.OK);
}
public static &lt;T&gt; T getObject(Class&lt;T&gt; clazz) throws IllegalAccessException, InstantiationException {
    return clazz.newInstance();
} 
</code></pre>