JavaUI: Effects for Controlling UI Object Access

  • Colin S. Gordon
  • Werner Dietl
  • Michael D. Ernst
  • Dan Grossman
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7920)


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 a polymorphic 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.


Subject Program Polymorphic Type Software Transactional Memory Graphical User Interface Program Public Void 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Ingalls, D.H.H.: The Smalltalk-76 Programming System: Design and Implementation. In: POPL (1978)Google Scholar
  2. 2.
    Zhang, S., Lü, H., Ernst, M.D.: Finding Errors in Multithreaded GUI Applications. In: ISSTA (2012)Google Scholar
  3. 3.
    Wright, A.K., Felleisen, M.: A Syntactic Approach to Type Soundness. Inf. Comput. 115(1), 38–94 (1994)MathSciNetzbMATHCrossRefGoogle Scholar
  4. 4.
    Gordon, C.S., Dietl, W.M., Ernst, M.D., Grossman, D.: Java UI: Effects for Controlling UI Object Access. Technical Report UW-CSE-13-04-01, University of Washington (2013)Google Scholar
  5. 5.
    Papi, M.M., Ali, M., Correa Jr., T.L., Perkins, J.H., Ernst, M.D.: Practical Pluggable Types for Java. In: ISSTA (2008)Google Scholar
  6. 6.
    Dietl, W., Dietzel, S., Ernst, M.D., Muşlu, K., Schiller, T.: Building and Using Pluggable Type-Checkers. In: ICSE (2011)Google Scholar
  7. 7.
    Foster, J.S., Fähndrich, M., Aiken, A.: A Theory of Type Qualifiers. In: PLDI (1999)Google Scholar
  8. 8.
    Emir, B., Kennedy, A., Russo, C., Yu, D.: Variance and Generalized Constraints for \(C^{\sharp}\) Generics. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 279–303. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  9. 9.
    Wheeler, D.A.: SLOCCount,
  10. 10.
  11. 11.
  12. 12.
    Sutherland, D.F., Scherlis, W.L.: Composable Thread Coloring. In: PPoPP (2010)Google Scholar
  13. 13.
    Lucassen, J.M., Gifford, D.K.: Polymorphic Effect Systems. In: POPL (1988)Google Scholar
  14. 14.
    Marino, D., Millstein, T.: A Generic Type-and-Effect System. In: TLDI (2009)Google Scholar
  15. 15.
    Rytz, L., Odersky, M., Haller, P.: Lightweight Polymorphic Effects. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 258–282. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  16. 16.
    Bocchino Jr., R.L., Adve, V.S., Dig, D., Adve, S.V., Heumann, S., Komuravelli, R., Overbey, J., Simmons, P., Sung, H., Vakilian, M.: A Type and Effect System for Deterministic Parallel Java. In: OOPSLA (2009)Google Scholar
  17. 17.
    Kawaguchi, M., Rondon, P., Bakst, A., Jhala, R.: Deterministic Parallelism via Liquid Effects. In: PLDI (2012)Google Scholar
  18. 18.
    Wadler, P.: The Marriage of Effects and Monads. In: ICFP (1998)Google Scholar
  19. 19.
  20. 20.
    Herlihy, M., Luchangco, V., Moir, M., Scherer III, W.N.: Software transactional memory for dynamic-sized data structures. In: PODC (2003)Google Scholar
  21. 21.
    Harris, T., Marlow, S., Peyton-Jones, S., Herlihy, M.: Composable memory transactions. In: PPoPP (2005)Google Scholar
  22. 22.
    Blundell, C., Lewis, E., Martin, M.: Subtleties of Transactional Memory Atomicity Semantics. Computer Architecture Letters 5(2) (2006)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Colin S. Gordon
    • 1
  • Werner Dietl
    • 1
  • Michael D. Ernst
    • 1
  • Dan Grossman
    • 1
  1. 1.University of WashingtonUSA

Personalised recommendations