Scala中的_root_包是什么? [英] What is the _root_ package in Scala?

查看:131
本文介绍了Scala中的_root_包是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有Scala插件的IntelliJ IDEA。如果我在代码中引用HashMap,然后使用Alt-Enter添加导入,则包将导入为:

I'm using IntelliJ IDEA with the Scala plugin. If I reference HashMap in code, and then use Alt-Enter to add the import, the package gets imported as:

_root_.scala.collection.immutable.HashMap

root 的部分内容是什么?它似乎可以使用和不使用它。

What's the root part of this? It seems to work with and without it.

推荐答案

它必须做scala导入是相对的 - _root_ 为您提供了一种指定绝对包名称的方法。请参阅 Scala Wiki

It has to do scala imports being relative - _root_ gives you a way to specify an absolute package name. See the Scala Wiki

这篇关于Scala中的_root_包是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆