[wildfly] Replace port TargetValues with resolved TargetEnvironment values (IDEA-368933)

TargetValues rely on Promises which can lead to race conditions and error handling complications.
Direct value resolution through `TargetEnvironment` is more reliable and predictable.

While both approaches should handle WSL port forwarding similarly (binding server ports
from WSL to localhost for IDE access), the Promise-based `TargetValue` implementation
fails to establish correct binding for unknown reasons. This change implements a more
straightforward approach using direct `TargetEnvironment` resolution.


(cherry picked from commit 32299d93a5f5d14c1a8fa3bbfda8b9a4158ed96c)

IJ-CR-164758

GitOrigin-RevId: 8ecc5490dd363d21a665e5c305eb4e0887d934d8
This commit is contained in:
Alexander Koshevoy
2025-06-02 14:56:23 +02:00
committed by intellij-monorepo-bot
parent 05e6866ce3
commit fc675e0b84

View File

@@ -164,6 +164,7 @@ class JdkCommandLineSetup(private val request: TargetEnvironmentRequest) {
* @param localPort the local port that is listening for the incoming connections
* @return the promised value with the host and port the process started on the target may connect to be directed to the local one
*/
@Deprecated("Use `TargetEnvironment.getLocalPortBindings` after constructing `TargetEnvironment` instead")
fun requestLocalPortBinding(host: String, localPort: Int): TargetValue<HostPort> {
val binding = TargetEnvironment.LocalPortBinding(localPort, target = null)
request.localPortBindings.add(binding)