Why does the following code do not compile in Java 8. I know type inference is the culprit here, But I would like to have an explanation.
public class TypeInferenceProblem {
class ATest<E extends B>
{
private E find(C<? extends E> CObj)
{
return null;
}
public void findCs(List<? extends C<? extends E>> cList)
{
find(new C());// This compiles fine
for (C cObj : cList)
{
E cachedEntity = find(cObj); // This cause error in java 8 but works fine in java 7
}
}
}
class B{
}
class C <T> {
}
}