(fix): Debugger Classpath Loading and Initialization Order#927
(fix): Debugger Classpath Loading and Initialization Order#927krrish175-byte wants to merge 1 commit intoscalacenter:mainfrom
Conversation
…urceLookUpProvider
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #710 by reordering the initialization sequence in the DebugTools.apply method to load the SourceLookUpProvider before the binary decoder for Scala 3.
Changes:
- Moved sourceLookUp initialization before decoder initialization in DebugTools.scala
- Added comments explaining the initialization order
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SourceLookUpProvider(distinctEntries, logger) | ||
| } | ||
|
|
||
| // Load decoder after sourceLookUp - the decoder can reuse cached class data |
There was a problem hiding this comment.
The comment states "the decoder can reuse cached class data" but this appears to be inaccurate. The decoder (Scala3Decoder) creates its own classloader and reads from debuggee.classPath independently (see Scala3DecoderBridge line 46). There's no evidence of data sharing or cache reuse between sourceLookUp and the decoder. Consider revising this comment to more accurately describe the reason for this initialization order, such as "ensures all class entries are processed before decoder initialization" or similar.
| // Load decoder after sourceLookUp - the decoder can reuse cached class data | |
| // Load decoder after sourceLookUp to ensure all class entries are processed first |
Description
This PR addresses issue #710 by refactoring the initialization logic in DebugTools to fix classpath loading issues in the Scala debugger.
Key Changes
DebugTools.scala: Modified the apply method to initialize the SourceLookUpProvider before the BinaryDecoder. This ensures that class entries are processed in the correct order, preventing potential race conditions or missing classpath data when the decoder starts.
Verification
Compilation: Verified that the project compiles successfully.
Tests: Verified that tests run stably without crashes (execution > 20m).
Related Issues
Fixes #710
@adpi2 @tgodzik