RFR: 7903963: Fix "Run Configuration" Window Freeze Issue [v2]
Jorn Vernee
jvernee at openjdk.org
Mon Mar 10 10:36:05 UTC 2025
On Fri, 7 Mar 2025 17:30:19 GMT, Oleksii Sylichenko <duke at openjdk.org> wrote:
>> # When the Problem Occurs
>>
>> The JTReg "Run Configuration" window freezes when the user selects a JRE that is not present in the project's SDK list.
>>
>> # Why the Problem Occurs
>>
>> There is a method `applyEditorTo` in the `JTRegConfigurable.java` class, which is called repeatedly while the "Run Configuration" window is open. Within this method, the method `jrePathEditor.getJrePathOrName()` is invoked. As a result, when this method is called for a JRE path not listed in IDEA, it attempts to determine the Java version. If the user has selected a raw JDK image, a Java process is launched, and the version is obtained from the process output (see [org.jetbrains.jps.model.java.impl.JdkVersionDetectorImpl#detectJdkVersionInfo](https://github.com/JetBrains/intellij-community/blob/baba77ecf93f44a2ccb34e5b206e03c60817d511/jps/model-impl/src/org/jetbrains/jps/model/java/impl/JdkVersionDetectorImpl.java#L40)).
>>
>> This call is too resource-intensive to be executed on the UI thread, causing the window to freeze.
>>
>> # Steps to reproduce
>>
>> 1. Open a JDK project.
>> 2. Open the "Project Structure" window.
>> 3. Navigate to "Platform Settings → SDKs".
>> 4. Remove the JDK that is used as the JRE for tests, or create a copy of this JDK on your file system.
>> 5. Create a new "JTReg Run Configuration".
>> 6. In the "JRE" field, select a JDK path that is not present in the Project SDK list (either the removed JDK or the copied one).
>>
>> ## Actual result
>> - The window starts freezing, even after saving and reopening it.
>>
>> # Implemented Changes
>>
>> ## JTRegConfigurable.java
>> - Fix Javadoc for the class.
>> - Remove unused class field: `jtregDir`.
>> - Add Javadoc to the methods: `createUIComponents`, `applyEditorTo`, `resetEditorFrom`
>> - Fix window freeze caused by `jrePathEditor` in the method `applyEditorTo`.
>> - Add method `applyEditorJrePathTo` to optimize data retrieval from `jrePathEditor`.
>>
>> Since I implemented changes in this file, I also took the opportunity to clean up the code a bit.
>
> Oleksii Sylichenko has updated the pull request incrementally with one additional commit since the last revision:
>
> 7903963: Fix "Run Configuration" Window Freeze Issue
> - remove `final` from local variables
Marked as reviewed by jvernee (Committer).
-------------
PR Review: https://git.openjdk.org/jtreg/pull/250#pullrequestreview-2670480525
More information about the jtreg-dev
mailing list