开发者

scala package conflict

I have a library which has root package "scala", and now I have a proj开发者_开发百科ect using this library, and I have a sub package named "com.zjffdu.scala". And the class file in this package needs to import classes from the library. So I have the following import statement.

import scala._

But because this class is also in package "scala", the scala compiler will look for files in current directory rather than the library.

So how can I explicit to tell scala to import classes from the library.

Thanks


Use this:

import _root_.scala._

As you can see it's not very pretty — the best option is probably to avoid naming one of your packages scala.

And by the way — the root scala package is always preimported (though subpackages, of course, are not).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜