Skip to content

(fix): Debugger Classpath Loading and Initialization Order#927

Open
krrish175-byte wants to merge 1 commit intoscalacenter:mainfrom
krrish175-byte:fix/debugger-classpath-loading
Open

(fix): Debugger Classpath Loading and Initialization Order#927
krrish175-byte wants to merge 1 commit intoscalacenter:mainfrom
krrish175-byte:fix/debugger-classpath-loading

Conversation

@krrish175-byte
Copy link
Copy Markdown

@krrish175-byte krrish175-byte commented Jan 9, 2026

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// Load decoder after sourceLookUp - the decoder can reuse cached class data
// Load decoder after sourceLookUp to ensure all class entries are processed first

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Load classpath only once

2 participants