In Scala IDE I have the following code:
package pkg.one
object S {
class A
}
class S {
import pkg.one.S.A //all ok
}
and
package pkg.two
class Z(a: A) //error
How can I import the A class so that I can use it in the class Z? The Scala IDE offers two solutions: import pkg.one.S$.A and import pkg.one.S.A, the first one is just a plain error in itself and the second one does not work since it says it cannot find that class. I know there is also the import pkg.one.S#A kind of import, but the IDE considers the ‘#’ sign as error. I have been unable to understand how to solve this problem, reading general available info on importing Scala inner classes, since my case seems to be legal according to them.
Using scalac (through SBT), the working solution is
import pkg.one.S.A. Currently, the Scala-Ide eclipse plugin sees sometimes imaginary errors… I tend to avoid IDE, and when I use them (for huge projects with lots of Java stuff), I still do all compilations in a terminal with SBT.