Integrating the Habanero Java Race Detector into DrJava

Jarred, Vincent and the guys of the Habanero Java group are planning to add a race detector to the Habanero Java compiler adapter in DrJava. I won’t have much time to help them with this, but I gave them some pointers.

Adding a race detector pane

I would probably use a panel that is shown in the “Tabbed Panes” part at the bottom of DrJava. You could look at JUnitPanel (extending ErrorPanel, which has a list of errors with file-and-line location information) or at BreakpointsPanel (extending RegionsTreePanel, which has a tree of documents, each having line numbers in them).

Specialized handler for race condition runtime exceptions

Right now, we have special treatment for OutOfMemoryError exceptions. This portion is in

else if (lastError.startsWith("java.lang.OutOfMemoryError")) {

I don’t think this is the perfect place to put it, and we should probably refactor the code at some point so it doesn’t fill up MainFrame even more, but this is the simplest place to extend DrJava. That’s where you could display the race condition pane.

There is one problem: Since the exception is thrown in another JVM (interpreter JVM) and then passed to the JVM where the main DrJava IDE is running (main JVM), the exception would have to be serializable. Right now, we just pass a string, not the exception itself. Unless you want to change the current design, you probably have to put the file and line number information into the string and then parse it again in the IDE.

Compilation options for the Habanero Java compiler adapter

You can create a panel in the Preferences pane in and add options in Then, in
HjCompiler.transformHJCommand, you can check the state of those options, e.g. using
DrJava.getConfig().getSetting(HJ_USE_RACE_DETECTION) or something like that, to create the appropriate command line.


About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in DrJava. Bookmark the permalink.

Leave a Reply