scalacenter/scala-debug-adapter

Fails to access private member from an instance method

Closed this issue · 2 comments

While debugging on bloop, I stumbled upon this

private[dap] final class DebugAdapterConnection(
    val socket: Socket,
    adapter: DebugAdapterProxy
) extends Closeable {
  // ...
  def stackTrace(threadId: Long): Task[StackTraceResponseBody] = {
    // ...
    adapter.request(...) // <- breakpoint here
  }
}

And when I tried to evaluate adapter.request(...) I got an IllegalAccessError: class xxx.ExpressionXXX tried to access private field adapter. xxx.ExpressionXXX is in unnamed module of loader yyy

I used the snapshot version of the debugger. That's weird because it's not the first private member I tried to access from within the class 🤔

adpi2 commented

Expression evaluation does not work very well on Scala 2. To make it better we would need to translate the Scala 3 expression compiler to Scala 2 (using the Scala 2 compiler internals).

Probably fixed by #701