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 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.
Access provided by Autonomous University of Puebla. Download to read the full chapter text
Chapter PDF
Similar content being viewed by others
Keywords
- 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.
References
Ingalls, D.H.H.: The Smalltalk-76 Programming System: Design and Implementation. In: POPL (1978)
Zhang, S., Lü, H., Ernst, M.D.: Finding Errors in Multithreaded GUI Applications. In: ISSTA (2012)
Wright, A.K., Felleisen, M.: A Syntactic Approach to Type Soundness. Inf. Comput. 115(1), 38–94 (1994)
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)
Papi, M.M., Ali, M., Correa Jr., T.L., Perkins, J.H., Ernst, M.D.: Practical Pluggable Types for Java. In: ISSTA (2008)
Dietl, W., Dietzel, S., Ernst, M.D., Muşlu, K., Schiller, T.: Building and Using Pluggable Type-Checkers. In: ICSE (2011)
Foster, J.S., Fähndrich, M., Aiken, A.: A Theory of Type Qualifiers. In: PLDI (1999)
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)
Wheeler, D.A.: SLOCCount, http://www.dwheeler.com/sloccount/
Subclipse Issue 889, http://subclipse.tigris.org/issues/show_bug.cgi?id=889
Sutherland, D.F., Scherlis, W.L.: Composable Thread Coloring. In: PPoPP (2010)
Lucassen, J.M., Gifford, D.K.: Polymorphic Effect Systems. In: POPL (1988)
Marino, D., Millstein, T.: A Generic Type-and-Effect System. In: TLDI (2009)
Rytz, L., Odersky, M., Haller, P.: Lightweight Polymorphic Effects. In: Noble, J. (ed.) ECOOP 2012. LNCS, vol. 7313, pp. 258–282. Springer, Heidelberg (2012)
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)
Kawaguchi, M., Rondon, P., Bakst, A., Jhala, R.: Deterministic Parallelism via Liquid Effects. In: PLDI (2012)
Wadler, P.: The Marriage of Effects and Monads. In: ICFP (1998)
Phooey UI Framework, http://www.haskell.org/haskellwiki/Phooey
Herlihy, M., Luchangco, V., Moir, M., Scherer III, W.N.: Software transactional memory for dynamic-sized data structures. In: PODC (2003)
Harris, T., Marlow, S., Peyton-Jones, S., Herlihy, M.: Composable memory transactions. In: PPoPP (2005)
Blundell, C., Lewis, E., Martin, M.: Subtleties of Transactional Memory Atomicity Semantics. Computer Architecture Letters 5(2) (2006)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2013 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Gordon, C.S., Dietl, W., Ernst, M.D., Grossman, D. (2013). Java UI : Effects for Controlling UI Object Access. In: Castagna, G. (eds) ECOOP 2013 – Object-Oriented Programming. ECOOP 2013. Lecture Notes in Computer Science, vol 7920. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-39038-8_8
Download citation
DOI: https://doi.org/10.1007/978-3-642-39038-8_8
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-39037-1
Online ISBN: 978-3-642-39038-8
eBook Packages: Computer ScienceComputer Science (R0)