Skip to main content

Modular Transformation of Java Exceptions Modulo Errors

  • Conference paper
  • First Online:
Formal Methods for Industrial Critical Systems (FMICS 2021)

Abstract

Deductive verifiers are used more and more in both academia and industry to prevent costly bugs. Their capabilities of verifying concurrent programs are getting better, but they are still lagging behind with regard to many major programming language features such as exceptions. To improve the situation, this work presents a semantics of Java exceptions which reduces the annotation burden on the user, while still allowing verification of exceptions. This is accomplished by ignoring sources of errors which are irrelevant to functional verification. Additionally, to deal with the complex control flow introduced by finally, a transformation is proposed that simplifies verification of exceptional postconditions and finally into postconditions and goto. We implement the approach and evaluate it against several common exception patterns.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. Ahrendt, W., Beckert, B., Bubel, R., Hähnle, R., Schmitt, P.H., Ulbrich, M.: Deductive Software Verification - The KeY Book. LNCS, vol. 10001. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-49812-6

  2. Amighi, A., Blom, S., Huisman, M., Zaharieva-Stojanovski, M.: The VerCors project: setting up basecamp. In: Proceedings of the Sixth PLPV Workshop. ACM (2012). https://doi.org/10.1145/2103776.2103785

  3. Bicalho de Pádua, G.: Studying and Assisting the Practice of Java and C# Exception Handling. Masters, Concordia University, February 2018

    Google Scholar 

  4. Black Duck Open Hub: The Apache Hadoop Open Source Project on Open Hub: Languages Page (2018). https://www.openhub.net/p/Hadoop/analyses/latest/languages_summary

  5. Black Duck Open Hub: The Apache Tomcat Open Source Project on Open Hub: Languages Page (2018). https://www.openhub.net/p/tomcat/analyses/latest/languages_summary

  6. Blom, S., Darabi, S., Huisman, M., Oortwijn, W.: The VerCors tool set: verification of parallel and concurrent software. In: iFM, vol. 10510, pp. 102–110 (2017). https://doi.org/10.1007/978-3-319-66845-1_7

  7. Cok, D.R.: OpenJML: software verification for Java 7 using JML, OpenJDK, and Eclipse. EPTCS (2014). https://doi.org/10.4204/EPTCS.149.8

  8. Distefano, D., Parkinson, M.J.: jStar: towards practical verification for Java. In: Proceedings of the 23rd ACM SIGPLAN OOPSLA Conference. ACM (2008). https://doi.org/10.1145/1449764.1449782

  9. Dyer, R., Nguyen, H.A., Rajan, H., Nguyen, T.N.: Boa: a language and infrastructure for analyzing ultra-large-scale software repositories. In: 2013 35th ICSE. IEEE (2013). https://doi.org/10.1109/icse.2013.6606588

  10. Eilers, M.: Shortened github link to code-level documentation of get\_finally\_var method (2021). https://edu.nl/8a9qe

  11. Fragoso Santos, J., Maksimović, P., Naudžiünienė, D., Wood, T., Gardner, P.: JaVerT: JavaScript verification toolchain. In: Proceedings of the ACM Programming Language 2(POPL) (2017). https://doi.org/10.1145/3158138

  12. Freund, S.N.: The costs and benefits of Java bytecode subroutines. In: Formal Underpinnings of Java Workshop at OOPSLA 98 (1998)

    Google Scholar 

  13. Gillian Team: Gillian - a multi-language platform for compositional symbolic analysis (2020). https://gillianplatform.github.io/

  14. Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java language specification, Java SE 7th edn. (2000)

    Google Scholar 

  15. Gosling, J., et al.: The Java language specification, Java SE 16th edn. (2021)

    Google Scholar 

  16. Hähnle, R., Huisman, M.: Deductive Software Verification: From Pen-and-Paper Proofs to Industrial Tools. Springer (2019)

    Chapter  Google Scholar 

  17. Hamilton, J., Danicic, S.: An evaluation of current java bytecode decompilers. In: Ninth IEEE SCAM (2009). DOI: 10.1109/SCAM.2009.24

    Article  Google Scholar 

  18. Jacobs, B.: Verifast & Java’s “finally” clause (2020). https://groups.google.com/forum/#!topic/verifast/56uhVmdERwA

  19. Jacobs, B., Smans, J., Piessens, F.: A Quick Tour of the VeriFast Program Verifier. In: Programming Languages and Systems, vol. 6461. Springer (2010). https://doi.org/10.1007/978-3-642-17164-2_21

    Chapter  Google Scholar 

  20. Kery, M.B., Le Goues, C., Myers, B.A.: Examining programmer practices for locally handling exceptions. In: Proceedings of the 13th MSR Conference. ACM (2016). https://doi.org/10.1145/2901739.2903497

  21. Leavens, G.T., et al.: JML reference manual (2008). https://www.cs.ucf.edu/~leavens/JML/jmlrefman/jmlrefman_toc.html

  22. Marché, C., Paulin-Mohring, C., Urbain, X.: The Krakatoa tool for certification of Java/JavaCard programs annotated in JML. Journal of Logic and Algebraic Programming 58, 89-106 (2004). https://doi.org/10.1016/j.jlap.2003.07.006

  23. de Moura, L., Bjørner, N.: Z3: an efficient smt solver. In: TACAS. Springer (2008)

    Chapter  Google Scholar 

  24. Müller, P., Schwerhoff, M., Summers, A.J.: Viper: A verification infrastructure for permission-based reasoning. In: VMCAI. Springer (2016)

    Chapter  MATH  Google Scholar 

  25. Nakshatri, S., Hegde, M., Thandra, S.: Analysis of exception handling patterns in java projects: an empirical study. In: Proceedings of the 13th MSR Conference (2016). https://doi.org/10.1145/2901739.2903499

  26. O’Hearn, P.: Separation logic. Commun. ACM 62 (2019). https://doi.org/10.1145/3211968

  27. Osman, H., Chiş, A., Schaerer, J., Ghafari, M., Nierstrasz, O.: On the evolution of exception usage in Java projects. In: 2017 IEEE 24th SANER Conference (2017). https://doi.org/10.1109/SANER.2017.7884646

  28. Purohit, P., Tokekar, V.: An investigation of exception handling practices in.NET and Java environments. Int. J. Appl. Eng. Res. 13, 2130–2140 (2018)

    Google Scholar 

  29. Rubbens, R.: Improving support for Java exceptions and inheritance in VerCors. Master’s thesis, University of Twente (2020). https://essay.utwente.nl/81338/

  30. Rubbens, R.: Modular Transformation of Java Exceptions Modulo Errors: accompanying package (2021). https://doi.org/10.4121/14905251

  31. Sena, D., Coelho, R., Kulesza, U., Bonifácio, R.: Understanding the exception handling strategies of Java libraries: an empirical study. In: Proceedings of the 13th MSR Conference. ACM (2016). https://doi.org/10.1145/2901739.2901757

  32. Steinhöfel, D., Wasser, N.: A New Invariant Rule for the Analysis of Loops with Non-standard Control Flows. In: IFM, vol. 10510. Springer (2017). https://doi.org/10.1007/978-3-319-66845-1_18

    Chapter  Google Scholar 

  33. Vallée-Rai, R., Co, P., Gagnon, E., Hendren, L., Lam, P., Sundaresan, V.: Soot: a java bytecode optimization framework. CASCON First Decade High Impact Papers (2010). https://doi.org/10.1145/1925805.1925818

  34. VerCors Team: VerCors homepage (2020). https://vercors.ewi.utwente.nl/

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Robert Rubbens .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Rubbens, R., Lathouwers, S., Huisman, M. (2021). Modular Transformation of Java Exceptions Modulo Errors. In: Lluch Lafuente, A., Mavridou, A. (eds) Formal Methods for Industrial Critical Systems. FMICS 2021. Lecture Notes in Computer Science(), vol 12863. Springer, Cham. https://doi.org/10.1007/978-3-030-85248-1_5

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-85248-1_5

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-85247-4

  • Online ISBN: 978-3-030-85248-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics