Add reflection utility to fix split debugger error#8878
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces FlutterDebugSessionUtils, a utility class that uses reflection to manage debug session starts, ensuring compatibility across different IntelliJ Platform versions. Several launch and test runner classes have been refactored to use this utility. Feedback focuses on improving the utility class by reducing code duplication and method length, caching reflection Method objects for performance, and refining exception handling to properly unwrap InvocationTargetException for better error reporting.
deae97d to
6cfea4e
Compare
Collaborator
|
A few issues related to reflection:
Might be worth consolidating? Anyway.. considering linking back to one? |
pq
approved these changes
Mar 31, 2026
This was referenced Apr 15, 2026
auto-submit Bot
pushed a commit
that referenced
this pull request
May 4, 2026
## Summary - restore device-qualified Run/Debug tab titles on the newer IntelliJ split-debugger path - keep the existing descriptor mutation as a fallback for the older path - add a regression test that fails loudly if the reflective builder hooks disappear again Fixes #8907. ## Problem #8796 fixed the original `RunContentDescriptor.setDisplayName()` regression, but Blasko reported that plain IntelliJ still lost device labels while Android Studio worked: - #8795 (comment) The later split-debugger helper from #8878 moved newer IntelliJ builds onto `XDebuggerManager.newSessionBuilder()`, but that path never seeded the builder with the device-qualified session title. On split-debugger builds the visible tab title is derived from the builder configuration rather than the later descriptor mutation alone, so IntelliJ could regress while Android Studio stayed fine. ## Fix Pass the device-qualified title through `LaunchState` and `AttachState` into `FlutterDebugSessionUtils`, then configure the builder with: - `sessionName(...)` - `showTab(true)` - `contentToReuse(...)` before `startSession()` runs. The existing `RunContentDescriptor.setDisplayName()` reflection stays in place as a fallback for the older path. ## Tests - `./gradlew compileJava --console=plain` - `./gradlew test --tests io.flutter.run.LaunchStateTest --tests io.flutter.run.FlutterDebugSessionUtilsTest --console=plain` Manually tested and did indeed verify, the labels are back once again with this fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8831
There is an API change somewhere in 2025.3 which causes the error to be thrown during debugging.
I considered making this a separate plugin branch in #8877.
To test this change in IntelliJ IDEA 2026.1: