I’ve run the thread checker with the annotations inside DrJava and a very small set of annotations for Swing (I’ve namely made the
java.swing.tree model packages event thread-only and the table, tree and
JComponent classes event thread-only after they have been realized.
Running the unit tests generates a lot of of violations, but most of them (I’m not willing to say all just yet) are caused by two things:
- GUI model methods or methods that we have designated as event thread-only in our code get called during GUI setup:
Thread Violation: OnlyRunBy Current thread 'main', id 1, group 'main' did not match the event thread at edu.rice.cs.drjava.model.AbstractGlobalModel.setActiveDocument (AbstractGlobalModel.java:4126) at edu.rice.cs.drjava.model.AbstractGlobalModel.setActiveFirstDocument (AbstractGlobalModel.java:4202) at edu.rice.cs.drjava.model.AbstractGlobalModel._init (AbstractGlobalModel.java:401) at edu.rice.cs.drjava.model.AbstractGlobalModel.
(AbstractGlobalModel.java:344) at edu.rice.cs.drjava.model.DefaultGlobalModel. (DefaultGlobalModel.java:194) at edu.rice.cs.drjava.ui.MainFrame. (MainFrame.java:2563)
- We are calling those methods from within our unit tests and are simulating things that normally should occur on the event thread:
Thread Violation: OnlyRunBy Current thread 'main', id 1, group 'main' did not match the event thread at edu.rice.cs.drjava.model.AbstractGlobalModel.setActiveDocument (AbstractGlobalModel.java:4126) at edu.rice.cs.drjava.model.AbstractGlobalModel.newFile (AbstractGlobalModel.java:1055) at edu.rice.cs.drjava.model.AbstractGlobalModel.closeFiles (AbstractGlobalModel.java:1734) at edu.rice.cs.drjava.model.AbstractGlobalModel.closeFile (AbstractGlobalModel.java:1697) at edu.rice.cs.drjava.CommandLineTest.checkFile (CommandLineTest.java:404) at edu.rice.cs.drjava.CommandLineTest.testRelativePath (CommandLineTest.java:339)
These two reports aren’t strictly bugs. The first thing I will try to address by somehow tying model classes into the “after realized” scheme. For the second report, we should probably remodel our unit tests.