scalacenter / scala-debug-adapter

Implementation of the Debug Adapter Protocol for Scala

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Debug throws `Cannot evaluate because of java.lang.NegativeArraySizeException: -2` when evaluating list size

kasiaMarek opened this issue · comments

In repo: https://github.com/asarkar/99-scala
In P01.scala set breakpoint at line 10 (case lst :: Nil => lst), and debug P01Suite.scala "last element of a non-empty list" test. Try to evaluate l.size, see Cannot evaluate because of java.lang.NegativeArraySizeException: -2.

More info in the original issue: scalameta/metals#5997.

dap version: v3.1.5

Thanks for the report!

I’m the reporter of the metals ticket. Please note that no expression works in the watch panel for any code whatsoever, the watch panel is completely broken. Sometimes it shows another error message, but the exception is always some sort of array out of bounds.

@asarkar Thanks for the report and reproduction. Next time, could you avoid using such emphasis as: "the watch panel is completely broken". It can be perceived as aggressive and it won't help us fix the bug.

@adpi2 Actually, I don't see anything wrong with emphasizing a fact, so, I'm sorry but I won't be able to avoid doing that should it happen again. If that's perceived as aggressive, we can chalk it up to the reader's fragile ego.

commented

The problem with this build is the compiler is configured with -rewrite -indent and so it tries to rewrite the file during compilation. I can fix it by automatically filtering out those options.