create file test1.scala with following code:
package test
import java.io.FileInputStream
object Foo
create another file test2.scala with following code:
package test.java
object Bar
Now compile as scalac test1.scala test2.scala:
We get the error:
test.scala:2: error: object io is not a member of package test.java
import java.io.FileInputStream
^
one error found
I think the error is because Scala thinks that java above refers to package test.java. How to resolve this problem apart from renaming the package?
Or to simplify things, you might use an alias: