isntanceof weirdly doesn't compile when using java generics -



isntanceof weirdly doesn't compile when using java generics -

can explain me why first instanceof evaluation doesn't compile, sec 1 compile , run perfectly??

private <c extends classa, e extends classb & interfaceb> c dosomething(class<c> clazz, e entity) { if(entity instanceof someentity){ // line doesn't compile. system.out.println(); } object tmp = entity; if(tmp instanceof someentity){ // line compiles , runs perfectly. system.out.println(); } }

java generics compiler-errors instanceof

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -