Raphael Roth
Raphael Roth

Reputation: 27373

Variable not appearing when debugging scala code with IntelliJ IDEA

I try to debug a Scala program using IntelliJ's debugger. I'm wondering why the variable newx is not listed in the "Variables"-panel of the debugger:

enter image description here

I'm especially surprised because newx is not a lazy val. Is it omitted because it is never referenced later in the code and therefore garbage-collected?

Upvotes: 1

Views: 361

Answers (1)

Hüseyin Zengin
Hüseyin Zengin

Reputation: 1226

Scala compiler's optimization deletes it because you are not using it. You can see it by using it below or just use evaluate expression feature of Idea and type variable name and run, it will probably find it.

Upvotes: 2

Related Questions