Skip to content

Sync RuntimeProcess with upstream Eclipse platform - #745

Merged
robstryker merged 5 commits into
redhat-developer:masterfrom
robstryker:sync-runtime-process
Aug 20, 2026
Merged

Sync RuntimeProcess with upstream Eclipse platform#745
robstryker merged 5 commits into
redhat-developer:masterfrom
robstryker:sync-runtime-process

Conversation

@robstryker

Copy link
Copy Markdown
Collaborator

Summary

  • Ports ~10 years of upstream Eclipse improvements to RuntimeProcess.java, resynchronizing with the current eclipse.platform version while preserving RSP-specific adaptations (DebugPluginConstants, RuntimeProcessEventManager, String encoding)
  • Fixes all three SpotBugs findings: inconsistent sync on fExitValue, non-static inner class ProcessMonitorThread, and constructor thread-start ordering
  • Replaces the old sleep-polling termination loop with process.waitFor(timeout) and adds descendant process termination
  • Switches attribute storage from lazy HashMap to ConcurrentHashMap for thread safety

Test plan

  • mvn compile on launching bundle — passes
  • mvn verify on launching test bundle — all 9 tests pass
  • Full CI build
  • Verify SpotBugs no longer reports IS2_INCONSISTENT_SYNC, SIC_INNER_SHOULD_BE_STATIC for RuntimeProcess

🤖 Generated with Claude Code

robstryker and others added 5 commits August 20, 2026 12:11
Port improvements from eclipse.platform's RuntimeProcess.java that
accumulated since the original ~2015 fork. Fixes all three SpotBugs
findings (IS2_INCONSISTENT_SYNC, SIC_INNER_SHOULD_BE_STATIC,
SC_START_IN_CTOR ordering) and brings in upstream bug fixes.

Key changes:
- Fix inconsistent synchronization on fExitValue (now always written
  inside synchronized block in terminate() and terminated())
- Replace sleep-polling termination with process.waitFor(timeout)
- Terminate descendant processes on shutdown
- Use ConcurrentHashMap for thread-safe attribute storage
- Simplify ProcessMonitorThread: private, volatile fExit, no redundant
  fields, access outer class via RuntimeProcess.this
- Make fields final where appropriate (fMonitor, fStreamsProxy, fName,
  fCaptureOutput)
- Register process with launch before starting monitor thread (Bug 598)
- Use Objects.requireNonNull/equals in setAttribute

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace ~160 lines of shell-out environment parsing (exec of cmd.exe/env
with manual stdout parsing, Win9xME support) with System.getenv(), which
upstream Eclipse's LaunchManager already uses.

Fixes all three SpotBugs findings:
- Make singleton constructor private
- Change static cache fields to instance fields so synchronized(this)
  is the correct lock scope

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Exclude EI_EXPOSE_REP and EI_EXPOSE_REP2 from the api.dao package.
These DTOs are JSON-RPC data transfer objects where mutable field
exposure is by design — callers build up DTOs and hand them to the
serializer, so defensive copies would break expected usage patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace platform-default charset usage with StandardCharsets.UTF_8
across 8 production files. Platform default encoding varies by OS
and locale, which can cause data corruption when reading/writing
text that contains non-ASCII characters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ES_COMPARING_STRINGS_WITH_EQ: use equals() instead of == in Path
- SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR: private constructor and
  final instance field in RuntimeProcessEventManager
- SIC_INNER_SHOULD_BE_STATIC: make NullStreamMonitor static inner class
- URF_UNREAD_FIELD: remove unused provider field in StandardCommandHandler
- WMI_WRONG_MAP_ITERATOR: use entrySet() instead of keySet()+get() in
  StandardCommandHandler, StandardVMDebugger, ProcessUtility
- SF_SWITCH_NO_DEFAULT: add default cases in ServerManagementClientImpl

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant