有人可以向我解释为什么第一个评估实例不能编译,但第二个实例编译并运行完美吗?
private <C extends ClassA, E extends ClassB & InterfaceB> C
doSomething(Class<C> clazz, E entity)
{
if(entity instanceof SomeEntity){ // This line doesn't compile.
System.out.println();
}
Object tmp = entity;
if(tmp instanceof SomeEntity){ // This line compiles and runs perfectly.
System.out.println();
}
}