[scala] Fix a deprecation warning