Scala:关键字作为包名 [英] Scala: keyword as package name
本文介绍了Scala:关键字作为包名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用定义了一些 xxx.xxx.object 包的 Java 库(没有可用的源代码).Scala 抱怨包名称中存在对象",因此我无法从中导入,也无法使用完全限定名称引用其类.
I'm trying to use a Java library (no source code available) which defines some xxx.xxx.object package. Scala complains about the presence of "object" in the package name, so I can't import from it, and I can't refer to its classes with fully qualified name either.
有办法解决吗?
推荐答案
将对象包裹在 `(1 旁边的引号)中应该可以工作.
Wrapping the object in a ` (the quote next to 1) should work.
xxx.xxx.`object`
这篇关于Scala:关键字作为包名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文