I get the following warning whenever I start my Scala application:
WARN - imported `SVNProperties\' is permanently hidden by definition of object SVNProperties in packag
Also, make sure the name of the package you import =/= object name.
I got this warning when my class was importing classes in the same package.
Once I removed the unnecessary import, the warnings were removed.
Just to further expand on a comment posted by Nick, as this was the case for me:
Another common cause is that SVNProperties is in the same package and so is already in scope. Trying to import it explicitly results in this warning.
More concretely, you may have:
package app.core
// No need to import the following - it is already visible as
// you are in the same package
import app.core.SVNProperties
object SVNResource {
Use instead:
package app.core
object SVNResource {
(Opinion) As a matter of coding style you may want to camel case your variables differently like for eg. SvnProperties
, SvnResource
. It reads easier for most people, see also this question.
This happened to me after moving a class from one package to another, like in astasiak's case. I ran sbt clean
with no luck. For the life of me, I couldn't find the class in the old location.
However, I had other errors preventing me from building. When I fixed those, this error disappeared. My guess is that until you can build cleanly, sbt
still thinks you have the class is in the old package, and includes this error with any other build errors that are preventing you from building.
My advice? Check for other compilation errors and fix those -- you might be erroneously getting this error due to sbt
having an outdated view of your package structure since its last successful build.
You probably have code that looks something like this:
object Hidden {
import scala.collection.immutable
object immutable { def x = 7 }
}
except in a less obvious way. You're importing something--in my example, the package immutable
--and then you go and define something else with the same name that prevents you from using what you imported.
In particular, it looks like you tried to import SVNProperties
into SVNResource.scala
, except that SVNResource.scala
defines its own SVNProperties
which hides the import.
I encountered this warning after moving some classes from one package to another. I guess there was some conflict between the new location and binaries from the old location. In my case this helped:
sbt clean