Keep Flutter SDK cache entries distinct for symlinked paths - #9067
fernando-s97 wants to merge 1 commit into
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request modifies the Flutter SDK caching mechanism to use the normal path instead of the canonical path, preventing SDK leaks across projects using symlinks (e.g., FVM). It also replaces the IntelliJ FileChooser with Swing's JFileChooser in the settings configuration. The review feedback highlights that using JFileChooser on the Event Dispatch Thread (EDT) introduces severe threading violations (potential UI freezes) and a UX regression, and recommends reverting to the standard IntelliJ FileChooser.
| final JFileChooser fileChooser = new JFileChooser(getSdkPathText()); | ||
| fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); | ||
| fileChooser.setAcceptAllFileFilterUsed(false); | ||
| if (fileChooser.showOpenDialog(mySdkCombo) == JFileChooser.APPROVE_OPTION) { | ||
| final File file = fileChooser.getSelectedFile(); |
There was a problem hiding this comment.
[MUST-FIX] Reverting to Swing's JFileChooser introduces a severe threading violation and a major UX regression.
- Threading Violation (EDT Freeze):
JFileChooserperforms synchronous disk I/O (scanning directories, loading system icons, resolving network shares) on the Event Dispatch Thread (EDT) during initialization and whenshowOpenDialogis called. This can cause the entire IDE UI to freeze/hang, triggering "Application Hanging" reports and a poor user experience. - UX Regression:
JFileChooseruses the generic Swing look-and-feel, which does not match the IntelliJ theme, lacks IDE-specific features (like favorite paths, recent paths, virtual filesystems), and does not support remote development environments (e.g., JetBrains Gateway).
Please revert to the standard IntelliJ FileChooser. If preserving symlinks is a priority, we should explore alternative ways to handle this without resorting to JFileChooser on the EDT, or let users manually type/paste the symlink path in the editable combo box.
Note: Please also restore the deleted imports (FileChooser, FileChooserDescriptor, FileChooserDescriptorFactory, VirtualFile) and remove the unused java.io.File import.
FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
VirtualFile file = FileChooser.chooseFile(descriptor, mySdkCombo, null, null);
if (file != null) {References
- NEVER perform heavy operations (I/O, complex PSI searches) on the Event Dispatch Thread (EDT). (link)
4d03477 to
85140c3
Compare
Summary
Prevent
FlutterSdkcache entries from collapsing distinct configured SDK paths that resolve to the same canonical target. This preserves each project's selected path, including project-local FVM symlinks, when resolving its SDK instance.This addresses the cache-identity aspect of #6616. It does not change IntelliJ's SDK-directory chooser behavior.
Verification
Manual verification still needed:
Automated verification:
git diff --checkpassed../gradlew --no-configuration-cache --no-daemon --console=plain -Dkotlin.compiler.execution.strategy=in-process testreached successful Java compilation (one pre-existing deprecated API warning), but did not reach test execution: Gradle remained waiting on an included build after compilation and produced no test-result XML. This draft remains pending a completed test run.AUTHORSfile.CHANGELOG.mdif appropriate. This bug fix does not add a user-facing release-note entry.