Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
CheckThreadViolationRepaintManager gives false positives when used with SwingWorker #223
org.assertj.swing.edt.CheckThreadViolationRepaintManager works by inspecting the stack trace of repaint calls which are not on the EDT, and if it sees a swing package before the repaint call, it assumes that Swing called it. repaint() in itself can be called from any thread, but the assumption is that if a swing code calls repaint() outside the EDT, something else in Swing was manipulated outside the EDT.
Calling repaint() on the background thread of a SwingWorker is OK (as repaint() in itself is thread-safe) , but the problem is that this leaves a "javax.swing" in the stack trace, and confuses CheckThreadViolationRepaintManager . Note that newer versions of the "swinghelper" (from where this code is coming), do take SwingWorker into account, see for example https://github.com/floscher/swinghelper/blob/master/src/java/org/jdesktop/swinghelper/debug/CheckThreadViolationRepaintManager.java