开发者

Scala: "Too many arguments" Error in IntelliJ IDEA 11 using Scala 2.7.7

IntelliJ 10.5 and 11 both highlight the expression x(0) below as error stating that it uses "Too many arguments". However, there is no error when compiling and running the example. Due to downward compa开发者_StackOverflow中文版tibility, I have to use Scala 2.7.7. When using Scala 2.8 and upwards, IntelliJ stops complaining.

object HelloWorld {
  def main(args: Array[String]) {
    val x = List("Hello World!")
    println(x(0))
  }
}

Any suggestions? My project is full these correct expressions that get wrongly highlighted by IntelliJ.


If scalac anyways compiles it right, sounds like a bug in IDEA's Scala plugin (which is quite common). It could be that it doesn't work too well with Scala 2.7.7, in which case using an older version of the plugin might help (the older plugin might also require an older version of IDEA; for example try IDEA 9 and its Scala plugin).


It's because of different way to store scala specific information in bytecode. Before Scala 2.8 it was ScalaAttribute, now it's ScalaAnnotation. Current decompiler version can't work properly with Scala 2.7 generated bytecode. If you try to open any such class file in IntelliJ IDEA you will see that all methods has no parameters. You can try to put into Scala plugin directory scalap.jar from old plugin distributions, but I'm not sure about binary compatibility, so the only way is to use earlier versions of IDEA, use another IDE or not to use Scala 2.7.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜