What Is Thrown? Lightweight Precise Automatic Extraction of Exception Preconditions in Java Methods

Diego Marcilio, Carlo A. Furia
{"title":"What Is Thrown? Lightweight Precise Automatic Extraction of Exception Preconditions in Java Methods","authors":"Diego Marcilio, Carlo A. Furia","doi":"10.1109/ICSME55016.2022.00038","DOIUrl":null,"url":null,"abstract":"When a method throws an exception—its exception precondition—is a crucial element of the method’s documentation that clients should know to properly use it. Unfortunately, exceptional behavior is often poorly documented, and sensitive to changes in a project’s implementation details that can be onerous to keep synchronized with the documentation.We present WIT, an automated technique that extracts the exception preconditions of Java methods. WIT uses static analysis to analyze the paths in a method’s implementation that lead to throwing an exception. WIT’s analysis is precise, in that it only reports exception preconditions that are correct and correspond to feasible exceptional behavior. It is also lightweight: it only needs the source code of the class (or classes) to be analyzed— without building or running the whole project. To this end, its design uses heuristics that give up some completeness (WIT cannot infer all exception preconditions) in exchange for precision and ease of applicability.We ran WIT on 46 Java projects, where it discovered 11 875 exception preconditions in 10 234 methods, taking just 1 second per method on average. A manual analysis of a significant sample of these exception preconditions confirmed that WIT is 100% precise, and demonstrated that it can accurately and automatically document the exceptional behavior of Java methods.","PeriodicalId":300084,"journal":{"name":"2022 IEEE International Conference on Software Maintenance and Evolution (ICSME)","volume":"153 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"3","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2022 IEEE International Conference on Software Maintenance and Evolution (ICSME)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ICSME55016.2022.00038","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 3

Abstract

When a method throws an exception—its exception precondition—is a crucial element of the method’s documentation that clients should know to properly use it. Unfortunately, exceptional behavior is often poorly documented, and sensitive to changes in a project’s implementation details that can be onerous to keep synchronized with the documentation.We present WIT, an automated technique that extracts the exception preconditions of Java methods. WIT uses static analysis to analyze the paths in a method’s implementation that lead to throwing an exception. WIT’s analysis is precise, in that it only reports exception preconditions that are correct and correspond to feasible exceptional behavior. It is also lightweight: it only needs the source code of the class (or classes) to be analyzed— without building or running the whole project. To this end, its design uses heuristics that give up some completeness (WIT cannot infer all exception preconditions) in exchange for precision and ease of applicability.We ran WIT on 46 Java projects, where it discovered 11 875 exception preconditions in 10 234 methods, taking just 1 second per method on average. A manual analysis of a significant sample of these exception preconditions confirmed that WIT is 100% precise, and demonstrated that it can accurately and automatically document the exceptional behavior of Java methods.
扔了什么?Java方法中异常前提条件的轻量级精确自动提取
当一个方法抛出异常时——它的异常前提条件——是方法文档中的一个关键元素,客户机应该知道这个元素才能正确地使用它。不幸的是,异常行为通常没有得到很好的文档记录,并且对项目实现细节的变化很敏感,要与文档保持同步是很困难的。我们介绍了WIT,这是一种提取Java方法异常前提条件的自动化技术。WIT使用静态分析来分析方法实现中导致抛出异常的路径。WIT的分析是精确的,因为它只报告正确且对应于可行异常行为的异常前提条件。它也是轻量级的:它只需要分析一个类(或多个类)的源代码,而不需要构建或运行整个项目。为此,它的设计使用了启发式方法,放弃了一些完整性(WIT不能推断所有异常前提条件),以换取精度和适用性。我们在46个Java项目上运行了WIT,它在10234个方法中发现了11875个异常前提条件,平均每个方法只需要1秒。对这些异常前提条件的重要样本进行的手工分析证实了WIT是100%精确的,并且证明了它可以准确、自动地记录Java方法的异常行为。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信