[java/cs] Cleanup unnecessary casts when inside a special __magic__ block
[java/cs] Do not infer Null<ValueType> to ValueType on anonymous functions. Closes #2048