I think this is easier to show with an example.
Let's say I have a Condition case class, with a Condition companion object used to provide an alternative constructor, like this:
case class Condition(
field: String,
values: List[String])
}
object Condition {
def apply(field: String, value: String): Condition = {
Condition(field, List(value))
}
}
When I import it from another I get the following warning (which eventually turns into an error):
import utils.query.Condition
[warn] [...]/ConditionBuilder.scala:14: imported `Condition' is permanently hidden by definition of object Condition in package query
[warn] import utils.query.Condition
[warn] ^
[warn] one warning found
I want to have access to the Condition Type, when declargin the type of a variable, and to the companion object, when executing one of it's methods
Is there some way to achieve this and avoid this warning (other than renaming the companion object, of course)?