Fixing Java -> Scala conversion