Closed jukzi closed 1 year ago
Does it make the code perform better or are there hidden type casts that aren’t needed yet are paid for? I expect the latter and the code runs much more often than someone reads it.
It's just the result of a static code analysis. Nothing meaningful, however typesafe. i don't know what exactly you fear. But it would also be ok for me to not change anything.
I'll need to look at each change in context, when I have time, decide if it's in a performance sensitive area. Mostly I think that's not the case, and it looks like there are even cases where there are casts anyway...
Except for the XMLTypeFactoryImpl changes the other places are relatively performance sensitive and, in each case, within the body of the loop, the typed value is not actually used nor needed, so better to avoid the cost of the implicit cast. For the XMLTypeFactoryImpl changes, these methods are generated so should be fixed in the generator to generate the improved style. That change has been committed.
Thanks for drawing attention to this. 😃
Avoiding type-casts makes code easier to read.