[cs/java] handle __array__ calls similarly to TArrayDecl in CastDetect (closes #3577)