swingx
  1. swingx
  2. SWINGX-1526

Detect Swing threading violations in view components

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Plaf
    • Labels:
      None

      Description

      See http://stackoverflow.com/q/12600659/1076463

      Inexperienced Swing users often modify/create/... Swing components on another thread then the EDT. Checks in the SwingX components for the use of the correct thread, and a clear exception message when on the wrong thread would result in clear exceptions instead of vague threading issues.

      As already mentioned by kleopatra in the comments

      Though not entirely sure how we could do it without breaking backwards compatibility: there are rare cases when the EDT violation doesn't throw up, adding a check which barks will break those

      Possible solutions for this:

      • Use an assert for the check. Production code can run without asserts
      • Hide it behind a logger, e.g.
        if ( LOGGER.isTraceEnabled() && !EventQueue.isEventDispatchThread()){
          throw new RuntimeException( ... );
        }
        
      • Hide the checks behind a system property check (system property check to disable the check, so that it is on by default)

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            kleopatra
            Reporter:
            robin_stevens
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: