What is the _root_ package in Scala?

前端 未结 3 712
面向向阳花
面向向阳花 2020-12-10 00:41

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         


        
3条回答
  •  春和景丽
    2020-12-10 01:17

    You would only need it if inside your current package you had a nested package scala.collection.immutable containing HashMap. This would be preferred by a relative import without the _root_ part.

    Edit: That was not quite right, the problems start already if you have a scala package either as an ancestor or nested in the current package.

提交回复
热议问题