【发布时间】:2013-01-15 17:33:36
【问题描述】:
我最近更新到 Eclipse Juno,它也将我的 Scala 更新到了 2.10。我知道 Actor 现在已被弃用,但我仍然想使用它们。 scala-actors.jar 和 scala-actors-migration.jar 是我的 Eclipse 构建路径的一部分,但是,对于导入,我得到“对象演员不是包 scala 的成员”。任何将 scala 库重新添加到项目的尝试都失败了。
带有 Eclipse Juno 和 Scala 2.10 的 Mac OS X Lion。
一些代码(标记错误XXX):
import scala.actors.Actor XXX actors not found in scala
import scala.actors.Actor._ XXX actors not found in scala
class Solver() extends Actor { XXX Actor not found
def act() {
// Read file
val source = io.Source.fromFile("src/labyrinth.txt", "utf-8")
val lines = source.getLines.toList
source.close()
// Fill multidimensional array
var labyrinth = Array.ofDim[Cell](lines.length, lines.apply(0).length)
for (i <- 0 until lines.length) { // each line
for (j <- 0 until lines.apply(0).length) { // each column
labyrinth(i)(j) = new Cell(lines.apply(i).toList.apply(j)) // Fill array cell with character
}
}
// Search for start
for (k <- 0 until labyrinth(0).length) {
if (labyrinth(0)(k).character.toString() == "?") {
val start = new CheckCell(labyrinth, Array((1, k)), this).start // Kick off search
while (true) {
receive { XXX receive not found
case FoundSolution => XXX FoundSolution not found
Console.println("Pong: stop")
start ! Stop XXX Stop not found
exit()
}
}
}
}
}
}
【问题讨论】:
-
您是否有任何名为“scala”的目录、类路径的一部分或源目录?看起来编译器正在查找错误的 scala 包,这可能是由此产生的。确保你自己没有定义一个'scala'包,这可能会影响真正的包!
标签: scala scala-2.10 scala-ide