RFR: 7903963: Fix "Run Configuration" Window Freeze Issue

Oleksii Sylichenko duke at openjdk.org
Fri Mar 7 17:17:43 UTC 2025


# 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.

-------------

Commit messages:
 - JTRegConfigurable.java:

Changes: https://git.openjdk.org/jtreg/pull/250/files
  Webrev: https://webrevs.openjdk.org/?repo=jtreg&pr=250&range=00
  Issue: https://bugs.openjdk.org/browse/CODETOOLS-7903963
  Stats: 78 lines in 1 file changed: 71 ins; 3 del; 4 mod
  Patch: https://git.openjdk.org/jtreg/pull/250.diff
  Fetch: git fetch https://git.openjdk.org/jtreg.git pull/250/head:pull/250

PR: https://git.openjdk.org/jtreg/pull/250


More information about the jtreg-dev mailing list