Fixed java API (blocking for now, until java8/scala-2.12 compat)