[java/cs] Correctly set constructor arguments as capture. Closes #3578