I observed a behavior in which, when an SDK is configured as the Project SDK and is subsequently removed from the SDKs list without modifying the Project SDK reference, IntelliJ IDEA automatically resets the Project SDK name to a generic Java version string.
Steps to Reproduce:
-
Configure an SDK and set it as the Project SDK (e.g., Amazon Corretto 21).
-
Remove the selected SDK, choose as No SDK, and navigate to the SDKs tab without clicking Apply.
-
Remove the selected SDK from the SDKs list
-
Click Apply and OK.
-
Reopen Project Structure → SDKs.
Observed Behavior:
The previously removed SDK still appears as the Project SDK, but its name is reset to a generic Java version string (e.g., java version "21.0.9").
Questions:
-
Is this automatic renaming behavior expected?
-
In this scenario,
sdk.getVersionString()returns the generic Java version string after the SDK is removed from the SDKs list. Is there an alternative API or property that preserves the original custom SDK name?
Any clarification or guidance would be greatly appreciated.