JavaUI: Effects for Controlling UI Object Access

Gordon, Colin S., Dietl, Werner, Ernst, Michael D., Grossman, Dan

Proceedings of the 27th European Conference on Object-Oriented Programming (ECOOP'13), July 2013, doi: 10.1007/978-3-642-39038-8_8

Abstract

Most graphical user interface (GUI) libraries forbid accessing UI elements from threads other than the UI event loop thread. Violating this requirement leads to a program crash or an inconsistent UI. Unfortunately, such errors are all too common in GUI programs. We present the first type and effect system that prevents non-UI threads from accessing UI objects or invoking UI-thread-only methods. The type system still permits non-UI threads to hold and pass references to UI objects. We implemented this type system for Java and annotated 8 Java programs (over 140KLOC) for the type system, including several of the most popular Eclipse plugins. We confirmed bugs found by unsound prior work, found an additional bug and code smells, and demonstrated that the annotation burden is low. We also describe code patterns our effect system handles less gracefully or not at all, which we believe offers lessons for those applying other effect systems to existing code.

Bibtex

@inproceedings{ecoop13,
  title = {{JavaUI: Effects for Controlling UI Object Access}},
  author = {Gordon, Colin S. and Dietl, Werner and Ernst, Michael D. and Grossman, Dan},
  year = 2013,
  booktitle = {{Proceedings of the 27th European Conference on Object-Oriented Programming
  (ECOOP'13)}},
  address = {{Montpellier, France}},
  month = {July},
  doi = {10.1007/978-3-642-39038-8_8},
  abstract = {
Most graphical user interface (GUI) libraries forbid accessing UI elements from threads other than the UI event loop thread. Violating this requirement leads to a program crash or an inconsistent UI. Unfortunately, such errors are all too common in GUI programs. We present the first type and effect system that prevents non-UI threads from accessing UI objects or invoking UI-thread-only methods. The type system still permits non-UI threads to hold and pass references to UI objects. We implemented this type system for Java and annotated 8 Java programs (over 140KLOC) for the type system, including several of the most popular Eclipse plugins. We confirmed bugs found by unsound prior work, found an additional bug and code smells, and demonstrated that the annotation burden is low. We also describe code patterns our effect system handles less gracefully or not at all, which we believe offers lessons for those applying other effect systems to existing code.
  },
  note = "Acceptance Rate 25\% (29/116).",
  url = {http://link.springer.com/chapter/10.1007/978-3-642-39038-8_8}
}