Reputation: 89
I have a worksheet containing
object test {
val tableTest = new Array[String](1)
tableTest.length
}
that returns
tableTest: Array[String] = [Ljava.lang.String;@628c5fdf
res0: Int = 1
and it seems ok.
However, when I enter this worksheet:
object test {
val tableTest = new Array[String](1)
tableTest(0) = "zero"
}
IntelliJ cannot compile and returns me a Unable to read an event from: rO0ABXNyADdvcmcuamV0YnJhaW5zLmpwcy5pbmNyZW1lbnRhbC...
error.
Did I do something wrong?
Upvotes: 1
Views: 970
Reputation: 190
I'm having the same issue with latest Idea and Scala plugin.
It seems that the worksheet has a problem executing any line which evaluates to Unit. Assigning is Unit, that's why your tableTest(0) = "zero"
fails.
I've temporarily solved it with the following workaround:
this line will fail with error Error:Unable to read an event from:...
println("Will fail")
You can fix it by defining this helper method and using it for any Unit expression:
def unit(f: => Unit): String = {f; ""}
unit(println("Will work"))
You just have to ignore the line it generates in the output panel with res0: String =
You also can put this method in some object and import in any WS you need.
Gaston.
@ktonga
Upvotes: 1