Lightweight precise automatic extraction of exception preconditions in java methods

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 on...

Celý popis

Uloženo v:
Podrobná bibliografie
Vydáno v:Empirical software engineering : an international journal Ročník 29; číslo 1; s. 30
Hlavní autoři: Marcilio, Diego, Furia, Carlo A.
Médium: Journal Article
Jazyk:angličtina
Vydáno: New York Springer US 01.02.2024
Springer Nature B.V
Témata:
ISSN:1382-3256, 1573-7616, 1573-7616
On-line přístup:Získat plný text
Tagy: Přidat tag
Žádné tagy, Buďte první, kdo vytvoří štítek k tomuto záznamu!
Popis
Shrnutí: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 and constructors. 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 the JDK and 46 Java projects, where it discovered 30 487 exception preconditions in 24 461 methods, taking less than two seconds per analyzed public 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 document the exceptional behavior of Java methods.
Bibliografie:ObjectType-Article-1
SourceType-Scholarly Journals-1
ObjectType-Feature-2
content type line 14
content type line 23
Communicated by: Paris Avgeriou and Dave Binkley
ISSN:1382-3256
1573-7616
1573-7616
DOI:10.1007/s10664-023-10392-x