Extract local variable is a well-known and widely used refactoring. It is frequently employed to replace one or more occurrences of a complex expression with simple accesses to a newly added variable. Although most IDEs provide tool support for extract local variables, such tools without deep analysis of the refactorings may result in semantic errors. To this end, in this paper, we propose a novel and more reliable approach, called \emph{ValExtractor}, to conduct extract variable refactorings automatically. The major challenge of automated extract local variable refactorings is how to efficiently and accurately identify the side effect of the extracted expressions and the potential interaction between the extracted expressions and their contexts without time-consuming dynamic execution of the involved programs. To resolve this challenge, ValExtractor leverages a lightweight static source code analysis to validate the side effect of the selected expression, and to identify which occurrences of the selected expression could be extracted together without changing the semantics of the program or introducing potential new exceptions. Our evaluation results on open-source Java applications suggest that Eclipse and IntelliJ IDEA, the state-of-the-practice refactoring engines, resulted in a large number of faulty extract variable refactorings whereas ValExtractor successfully avoided all such errors. The proposed approach has been merged into (and distributed with) Eclipse to improve the safety of extract local variable refactoring.
Tue 5 DecDisplayed time zone: Pacific Time (US & Canada) change
14:00 - 15:30 | Program Analysis IResearch Papers / Demonstrations / Industry Papers at Golden Gate C3 Chair(s): Michael Pradel University of Stuttgart | ||
14:00 15mTalk | An Automated Approach to Extracting Local Variables Research Papers Xiaye Chi Beijing Institute of Technology, Hui Liu Beijing Institute of Technology, Guangjie Li National Innovation Institute of Defense Technology, Weixiao Wang Beijing Institute of Technology, Yunni Xia Chongqing University, Yanjie Jiang Peking University, Yuxia Zhang Beijing Institute of Technology, Weixing Ji Beijing Institute of Technology Media Attached | ||
14:15 15mTalk | Incrementalizing Production CodeQL Analyses Industry Papers Tamás Szabó GitHub Next DOI Media Attached | ||
14:30 15mTalk | Statistical Reachability Analysis Research Papers Seongmin Lee Max Planck Institute for Security and Privacy (MPI-SP), Marcel Böhme Max Planck Institute for Security and Privacy Media Attached | ||
14:45 15mTalk | PPR: Pairwise Program Reduction Research Papers Mengxiao Zhang University of Waterloo, Zhenyang Xu University of Waterloo, Yongqiang Tian The Hong Kong University of Science and Technology; University of Waterloo, Yu Jiang Tsinghua University, Chengnian Sun University of Waterloo Media Attached | ||
15:00 15mTalk | When Function Inlining Meets WebAssembly: Counterintuitive Impacts on Runtime Performance Research Papers Pre-print Media Attached | ||
15:15 7mTalk | Ad Hoc Syntax-Guided Program Reduction Demonstrations Jia Le Tian University of Waterloo, Mengxiao Zhang University of Waterloo, Zhenyang Xu University of Waterloo, Yongqiang Tian The Hong Kong University of Science and Technology; University of Waterloo, Yiwen Dong , Chengnian Sun University of Waterloo Media Attached |