Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1094811.1094847acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations

Published: 12 October 2005 Publication History
  • Get Citation Alerts
  • Abstract

    Ever since their invention 30 years ago, checked exceptions have been a point of much discussion. On the one hand, they increase the robustness of software by preventing the manifestation of unanticipated checked exceptions at run-time. On the other hand, they decrease the adaptability of software because they must be propagated explicitly, and must often be handled even if they cannot be signalled.We show that the problems with checked exceptions are caused by a lack of expressiveness of the exceptional return type of a method, which currently dictates a copy & paste style. We add the required expressiveness by introducing anchored exception declarations, which allow the exceptional behavior of a method to be declared relative to that of others. We present the formal semantics of anchored exception declarations, along with the necessary rules for ensuring compile-time safety, and give a proof of soundness. We show that anchored exception declarations do not violate the principle of information hiding when used properly, and provide a guideline for when to use them.We have implemented anchored exception declarations in Cappuccino, which is an extension to the ClassicJava programming language.

    References

    [1]
    J. Aldrich and K. Donnelly. Selective open recursion: Modular reasoning about components and inheritance. In Proc. FSE 2004 Workshop on Specification and Verification of Component-Based Systems.]]
    [2]
    M. Allen and S. Horwitz. Slicing Java programs that throw and catch exceptions. In PEPM '03: Proceedings of the 2003 ACM SIGPLAN workshop on Partial evaluation and semantics-based program manipulation, pages 44--54, New York, NY, USA, 2003. ACM Press.]]
    [3]
    M. Barnett, K. R. M. Leino, and W. Schulte. The Spec# programming system: An overview. In CASSIS 2004 proceedings, 2004.]]
    [4]
    P. A. Buhr and W. Y. R. Mok. Advanced exception handling mechanisms. IEEE Trans. Softw. Eng., 26(9):820--836, 2000.]]
    [5]
    B.-M. Chang, J. Jo, K. Yi, and K. Choe. Interprocedural exception analysis for Java. In Proceedings of the 16th ACM Symposium on Applied Computing, March 2001.]]
    [6]
    R. Chatterjee, B. G. Ryder, and W. A. Landi. Complexity of points-to analysis of Java in the presence of exceptions. IEEE Trans. Softw. Eng., 27(6):481--512, 2001.]]
    [7]
    J.-D. Choi, D. Grove, M. Hind, and V. Sarkar. Efficient and precise modeling of exceptions for the analysis of Java programs. In PASTE '99: Proceedings of the 1999 ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering, pages 21--31, New York, NY, USA, 1999. ACM Press.]]
    [8]
    C. Dony. Exception handling and object-oriented programming: towards a synthesis. In Proceedings of the European conference on object-oriented programming on Object-oriented programming systems, languages, and applications, pages 322--330. ACM Press, 1990.]]
    [9]
    ECMA Technical Committee 39 (TC39) Task Group 2 (TG2). C# Language Specification. ECMA, 2 edition, December 2002.]]
    [10]
    M. Fähndrich and A. Aiken. Program analysis using mixed term and set constraints. In SAS '97: Proceedings of the 4th International Symposium on Static Analysis, pages 114--126, London, UK, 1997. Springer-Verlag.]]
    [11]
    M. Fähndrich and A. Aiken. Refined type inference for ML. In Proceedings of the 1st Workshop on Types in Compilation, June 1997.]]
    [12]
    M. Fähndrich, J. S. Foster, A. Aiken, and J. Cu. Tracking Down Exceptions in Standard ML. Technical Report UCB//CSD-98-996, University of California, Berkeley, Feb. 1998.]]
    [13]
    M. Flatt, S. Krishnamurthi, and M. Felleisen. Classes and mixins. In POPL '98: Proceedings of the 25th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 171--183. ACM Press, 1998.]]
    [14]
    E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design patterns: elements of reusable object-oriented software. Addison-Wesley Longman Publishing Co., Inc., 1995.]]
    [15]
    A. F. Garcia, C. M. F. Rubira, A. Romanovsky, and J. Xu. A comparative study of exception handling mechanisms for building dependable object-oriented software. The Journal of Systems and Software, 59(2):197--222, 2001.]]
    [16]
    K. Glynn, P. J. Stuckey, M. Sulzmann, and H. Sondergaard. Exception analysis for non-strict languages. In ICFP '02: Proceedings of the seventh ACM SIGPLAN International conference on Functional programming, pages 98--109, New York, NY, USA, 2002. ACM Press.]]
    [17]
    J. B. Goodenough. Exception handling: issues and a proposed notation. Commun. ACM, 18(12):683--696, 1975.]]
    [18]
    J. Gosling et al. The Java Language Specification, Second Edition. Addison-Wesley Longman Publishing Co., Inc., 2000.]]
    [19]
    J. Guzmán and A. Suárez. An Extended Type System for Exceptions. In Record of the fifth ACM SIGPLAN workshop on ML and its Applications, June 1994. Also appears as Research Report 2265, INRIA, BP 105 - 78153 Le Chesnay Cedex, France.]]
    [20]
    A. Hejlsberg. The trouble with checked exceptions. http://www.artima.com/intv/handcuffs.html.]]
    [21]
    R. Helm, I. M. Holland, and D. Gangopadhyay. Contracts: specifying behavioral compositions in object-oriented systems. In Proceedings of the European conference on object-oriented programming on Object-oriented programming systems, languages, and applications, pages 169--180. ACM Press, 1990.]]
    [22]
    A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst., 23(3):396--450, 2001.]]
    [23]
    B. Jacobs. A formalisation of Java's exception mechanism. In ESOP '01: Proceedings of the 10th European Symposium on Programming Languages and Systems, pages 284--301. Springer-Verlag, 2001.]]
    [24]
    J. Jo, B.-M. Chang, K. Yi, and K.-M. Choe. An uncaught exception analysis for Java. Journal of Systems and Software, 72(1):59--69, 2004.]]
    [25]
    S. P. Jones, A. Reid, F. Henderson, T. Hoare, and S. Marlow. A semantics for imprecise exceptions. In PLDI '99: Proceedings of the ACM SIGPLAN 1999 conference on Programming language design and implementation, pages 25--36, New York, NY, USA, 1999. ACM Press.]]
    [26]
    J. Lamping. Typing the specialization interface. In Proceedings of the eighth annual conference on Object-oriented programming systems, languages, and applications, pages 201--214. ACM Press, 1993.]]
    [27]
    G. T. Leavens, A. L. Baker, and C. Ruby. Preliminary design of JML: A behavioral interface specification language for Java. Technical Report 98-06i, 2000.]]
    [28]
    K. R. M. Leino and W. Schulte. Exception safety for C#. In J. Cuellar and Z. Liu, editors, Proceedings, Software Engineering and Formal Methods (SEFM), Beijing, China. IEEE Press, 2004.]]
    [29]
    M. Lippert and C. Lopes. A study on exception detection and handling using aspect-oriented programming. Technical report, Xerox PARC, 1999.]]
    [30]
    B. Liskov. Abstraction and specification in program development. MIT Press, 1986.]]
    [31]
    B. Liskov and J. Wing. Family values: A behavioral notion of subtyping. Technical Report MIT/LCS/TR-562b, 1993.]]
    [32]
    B. Meyer. Object-oriented software construction (2nd ed.). Prentice-Hall, Inc., 1997.]]
    [33]
    B. Meyer. Overloading vs. object technology. Journal of Object-Oriented Programming, October 2001.]]
    [34]
    A. Mikhailova and A. Romanovsky. Supporting evolution of interface exceptions. In Advances in exception handling techniques, pages 94--110. Springer-Verlag New York, Inc., 2001.]]
    [35]
    R. Miller and A. Tripathi. Issues with exception handling in object-oriented systems. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP '97), volume 1241 of LNCS, page 85, Jyväskylä, Finland, June 1997. Springer.]]
    [36]
    D. L. Parnas. On the criteria to be used in decomposing systems into modules. In Software pioneers: contributions to software engineering, pages 411--427. Springer-Verlag New York, Inc., 2002.]]
    [37]
    F. Pessaux and X. Leroy. Type-based analysis of uncaught exceptions. In Symposium on Principles of Programming Languages, pages 276--290, 1999.]]
    [38]
    B. Potter, J. Sinclair, and D. Till. An introduction to formal specification and Z. Prentice-Hall, Inc., 1991.]]
    [39]
    M. P. Robillard and G. C. Murphy. Analyzing exception flow in Java programs. In Software Engineering -- ESEC/FSE'99, volume 1687 of Lecture Notes in Computer Science, pages 322--337. Springer-Verlag, September 1999.]]
    [40]
    M. P. Robillard and G. C. Murphy. Designing robust Java programs with exceptions. In Proceedings of the 8th ACM SIGSOFT international symposium on Foundations of software engineering, pages 2--10. ACM Press, 2000.]]
    [41]
    M. P. Robillard and G. C. Murphy. Static analysis to support the evolution of exception structure in object-oriented systems. ACM Trans. Softw. Eng. Methodol., 12(2):191--221, 2003.]]
    [42]
    A. Romanovsky and B. Sandén. Except for exception handling... Ada Lett., XXI(3):19--25, 2001.]]
    [43]
    B. G. Ryder, D. Smith, U. Kremer, M. Gordon, and N. Shah. A static study of Java exceptions using JESP. In Computational Complexity, pages 67--81, 2000.]]
    [44]
    S. Ryu and K. Yi. Exception analysis for multithreaded Java programs. In APAQS '01: Proceedings of the Second Asia-Pacific Conference on Quality Software, page 23, Washington, DC, USA, 2001. IEEE Computer Society.]]
    [45]
    C. F. Schaefer and G. N. Bundy. Static analysis of exception handling in Ada. Softw., Pract. Exper., 23(10):1157--1174, 1993.]]
    [46]
    S. Sinha and M. J. Harrold. Analysis of programs with exception-handling constructs. In ICSM '98: Proceedings of the International Conference on Software Maintenance, page 348, Washington, DC, USA, 1998. IEEE Computer Society.]]
    [47]
    N. Smeets and M. van Dooren. Jnome, 2004. http://www.jnome.org.]]
    [48]
    P. Steyaert, C. Lucas, K. Mens, and T. D'Hondt. Reuse contracts: managing the evolution of reusable assets. In Proceedings of the 11th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 268--285. ACM Press, 1996.]]
    [49]
    M. van Dooren and E. Steegmans. Combining the robustness of checked exceptions with the flexibility of unchecked exceptions using anchored exception declarations. Technical Report CW 407, Katholieke Universiteit Leuven, March 2005.]]
    [50]
    G. van Rossum. Python reference manual. Report CS-R9525, Apr. 1995.]]
    [51]
    W. Winston. Operations Research: Applications and Algorithms. Duxbury, 2003.]]
    [52]
    S. Yemini and D. M. Berry. A modular verifiable exception handling mechanism. ACM Trans. Program. Lang. Syst., 7(2):214--243, 1985.]]
    [53]
    S. Yemini and D. M. Berry. An axiomatic treatment of exception handling in an expression-oriented language. ACM Trans. Program. Lang. Syst., 9(3):390--407, 1987.]]
    [54]
    K. Yi. Compile-time detection of uncaught exceptions in standard ML programs. In The 1st International Static Analysis Symposium, volume 864 of Lecture Notes in Computer Science, pages 238--254, Namur, September 1994.]]
    [55]
    K. Yi. An abstract interpretation for estimating uncaught exceptions in standard ML programs. Science of Computer Programming, 31(1):147--173, 1998. (invited paper).]]
    [56]
    K. Yi and S. Ryu. Towards a cost-effective estimation of uncaught exceptions in SML programs. In Proceedings of the Annual International Static Analysis Symposium, volume 1302 of Lecture Notes in Computer Science, pages 98--113, Paris, France, September 1997.]]

    Cited By

    View all
    • (2022)Detecting Runtime Exceptions by Deep Code Representation Learning with Attention-Based Graph Neural Networks2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER53432.2022.00053(373-384)Online publication date: Mar-2022
    • (2021)Polymorphic Iterable Sequential Effect SystemsACM Transactions on Programming Languages and Systems10.1145/345027243:1(1-79)Online publication date: 17-Apr-2021
    • (2018)JEff: objects for effectProceedings of the 2018 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3276954.3276955(111-124)Online publication date: 24-Oct-2018
    • Show More Cited By

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    OOPSLA '05: Proceedings of the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
    October 2005
    562 pages
    ISBN:1595930310
    DOI:10.1145/1094811
    • cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 40, Issue 10
      Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming systems languages and applications
      October 2005
      531 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/1103845
      Issue’s Table of Contents
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 12 October 2005

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Cappuccino
    2. anchored exception declaration
    3. exception handling

    Qualifiers

    • Article

    Conference

    OOPSLA05
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 268 of 1,244 submissions, 22%

    Upcoming Conference

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)6
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 10 Aug 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2022)Detecting Runtime Exceptions by Deep Code Representation Learning with Attention-Based Graph Neural Networks2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)10.1109/SANER53432.2022.00053(373-384)Online publication date: Mar-2022
    • (2021)Polymorphic Iterable Sequential Effect SystemsACM Transactions on Programming Languages and Systems10.1145/345027243:1(1-79)Online publication date: 17-Apr-2021
    • (2018)JEff: objects for effectProceedings of the 2018 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3276954.3276955(111-124)Online publication date: 24-Oct-2018
    • (2016)Accepting blame for safe tunneled exceptionsACM SIGPLAN Notices10.1145/2980983.290808651:6(281-295)Online publication date: 2-Jun-2016
    • (2016)Accepting blame for safe tunneled exceptionsProceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2908080.2908086(281-295)Online publication date: 2-Jun-2016
    • (2014)Trading robustness for maintainability: an empirical study of evolving c# programsProceedings of the 36th International Conference on Software Engineering10.1145/2568225.2568308(584-595)Online publication date: 31-May-2014
    • (2014)How Does Exception Handling Behavior Evolve? An Exploratory Study in Java and C# ApplicationsProceedings of the 2014 IEEE International Conference on Software Maintenance and Evolution10.1109/ICSME.2014.25(31-40)Online publication date: 29-Sep-2014
    • (2013)New exception interfaces for Java-like languagesProceedings of the 28th Annual ACM Symposium on Applied Computing10.1145/2480362.2480675(1661-1666)Online publication date: 18-Mar-2013
    • (2013)On exceptions, events and observer chainsProceedings of the 12th annual international conference on Aspect-oriented software development10.1145/2451436.2451458(185-196)Online publication date: 24-Mar-2013
    • (2013)The crosscutting impact of the AOSD Brazilian research communityJournal of Systems and Software10.1016/j.jss.2012.08.03186:4(905-933)Online publication date: 1-Apr-2013
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media