What happens if you update a Swing GUI outside of the event dispatch thread?
Asked in the hiring manager / panel interview stage. Implement a validator that identifies unsafe Swing operations. An operation is unsafe when a direct component mutation occurs on a non-EDT thread. repaint, revalidate, and operations already running on the EDT are safe.
Implement validate_swing_updates(operations). Each operation is a dictionary with thread and action strings. Return the zero-based indices of unsafe operations in input order.
thread and actionthread is either EDT or workeraction is repaint, revalidate, or a direct component mutationdef validate_swing_updates(operations):