Skip to content

Y20251111-1000

@vogella vogella tagged this 11 Nov 14:30
The testDynamicRegistry test was failing randomly with
"Activity Listener not called" or "Category Listener not called" errors.

Root cause:
- The test uses a plain boolean array to track listener invocations
- Extension registry listeners may be invoked on different threads
- Without proper synchronization (volatile/atomic), changes to the array
  made by listener threads may not be visible to the test thread
- This causes DisplayHelper.waitForCondition() to timeout even when
  listeners were actually called

Fix:
- Replace boolean[] with AtomicBoolean instances for thread-safe visibility
- Use activityChanged.set(true) and categoryChanged.set(true) in listeners
- Use activityChanged.get() and categoryChanged.get() in assertions
- AtomicBoolean provides proper memory barriers ensuring cross-thread visibility

This approach ensures proper synchronization between the listener callback
threads and the test thread, eliminating the race condition that caused
random test failures.

Fixes https://github.com/eclipse-platform/eclipse.platform.ui/issues/2458

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Assets 2
Loading