Exception-aware Lifecycle-Model Construction for Framework APIs
The implementation of large-scale software systems usually depends on low-level frameworks,or third-party libraries.However,the evolution of these frameworks or libraries is independent of the upper-level applications,which brings challenges in upper-level code quality assurance.For instance,changes in framework/library code,such as adding or removing APIs and altering API semantics,may result in inconsistencies among different versions of the frame-work/library code.These inconsistencies can impact the quality of higher-level apps when devel-opers update frameworks/libraries.To address this issue,analyzing the evolution process of framework/library code APIs is essential.This analysis helps upper-level app developers swiftly choose compatible versions or adjust their code.In this context,analyzing the evolution process corresponds to constructing a framework API lifecycle model.Nowadays,existing works propose the API existence-changing model for defect detection,while not considering the influence of se-mantic changes in APIs,especially exception-related code evolution.To fill this gap,this paper adopts static analysis techniques to extract exception summary information in the framework API code,proposes a multi-step matching strategy to obtain the changing process of exceptions,and finally generates exception-aware API lifecycle models for the given framework/library project.Our approach:(1)adopts control-dependency slicing analysis to extract the conditions of the ex-ception-thrown statements;uses a parameter tracing strategy to transform exception-throwing conditions into external-variable-related preconditions;and performs inter-procedure precondition construction by a bottom-up summary-based analysis.(2)proposes the exact-matching and adap-tive-matching strategies to analyze the framework/library code changes including additions,dele-tions and modifications of APIs;generates exception-aware API lifecycle models which cover sev-en API changing types.With this approach,the API lifecycle extraction tool,JavaExP,is imple-mented,which is based on Java bytecode analysis.Compared to the state-of-the-art tool,the F1 score of exception summary information extracted by JavaExP has increased by 67%,with a re-duction in processing time by 87%.The evaluation of real-world projects shows that,compared to the exception-unaware API lifecycle modeling,JavaExP can identify 18%times more API changes.Among the 75,433 APIs under analysis,20%of APIs have changed their exception-throwing behavior at least once after API introduction.These APIs involve a total of more than 7K independent exception changes.The overall results show that the exception-aware lifecycle modeling can describe the evolution process of APIs more accurately.