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

c - Compilation of a code: unkown type name string -

ubuntu - Bash Script to Check That Files Are Being Created -

Php operator `break` doesn't stop while -