ReInstancer: Automatically Refactoring for Instanceof Pattern Matching
Pattern matching for instanceof is widely used with the advantage of conditionally extracting components from objects and with the disadvantage of the compulsory usage of type castings. It has been periodically proposed as the preview feature in lately published JDK to avoid redundant type castings and to optimize pattern matching in multi-branch statements. There is a strong need to provide full support of refactoring instanceof pattern matching. However, manual refactoring is time-consuming and tedious. Furthermore, none of the existing works and prevalent IDEs can provide sufficient support for such refactoring. To this end, this paper presents a refactoring tool ReInstancer that alleviates type castings by converting a multi-branch statement with instanceof pattern matching into a switch statement or expression automatically. ReInstancer is evaluated on 7 real-world applications, with a total of 4404 instanceof expressions. The evaluation results demonstrate that ReInstancer can successfully remove 2060 type castings and refactor 141 multi-branch statements with a total of 1972instanceofpattern matching, which improves the code quality. A video showing the tool is available at https://www.youtube.com/watch?v=V7qGQRRnwVA
Thu 12 MayDisplayed time zone: Eastern Time (US & Canada) change
03:00 - 04:00 | Modeling and RefactoringDEMO - Demonstrations at ICSE Demo room 2 Chair(s): Renzo Degiovanni SnT, University of Luxembourg | ||
03:00 15mDemonstration | ReInstancer: Automatically Refactoring for Instanceof Pattern Matching DEMO - Demonstrations Shuai Hong Hebei University of Science and Technology, Yang Zhang Hebei University of Science and Technology, Chaoshuai Li Hebei University of Science and Technology, Yu Bai Hebei University of Science and Technology DOI Pre-print Media Attached | ||
03:15 15mDemonstration | ML-Quadrat & DriotData: A Model-Driven Engineering Tool and a Low-Code Platform for Smart IoT Services DEMO - Demonstrations Armin Moin Technical University of Munich, Germany, Andrei Mituca DriotData UG, Munich, Germany, Moharram Challenger University of Antwerp, Atta Badii University of Reading, United Kingdom, Stephan Günnemann Technical University of Munich (TUM) & Munich Data Science Institute, Germany Pre-print Media Attached | ||
03:30 15mDemonstration | RM2Doc: A Tool for Automatic Generation of Requirements Documents from Requirements Models DEMO - Demonstrations Tianshu Bao School of Computer Science and Technology, Guizhou University, Jing Yang School of Computer Science and Technology, Guizhou University, Yilong Yang Beihang University, Yongfeng Yin School of Software, Beihang University DOI Pre-print Media Attached |