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
Post a Comment