Transforming programs between APIs with Many-to-Many Mappings
Transforming programs between two APIs or different versions of the same API is a common software engineering task. However, existing languages supporting for such transformation cannot satisfactorily handle the cases when the relations between elements in the old API and the new API are many-to-many mappings: multiple invocations to the old API are supposed to be replaced by multiple invocations to the new API. Since the multiple invocations of the original APIs may not appear consecutively and the variables in these calls may have different names, writing a tool correctly to cover all such invocation cases is not an easy task. In this paper we propose a novel guided-normalization approach to address this problem. Our core insight is that programs in different forms can be semantics-equivalently normalized into a basic form guided by transformation goals, and developers only need to write rules for the basic form to address the transformation. Based on this approach, we design a declarative program transformation language, PATL, for adapting Java programs between different APIs. PATL has simple syntax and basic semantics to handle transformations only considering consecutive statements inside basic blocks, while with guided-normalization, it can be extended to handle complex forms of invocations. Furthermore, PATL ensures that the user-written rules would not accidentally break def-use relations in the program. We formalize the semantics of PATL on Middleweight Java and prove the semantics-preserving property of guided-normalization. We also evaluated our language with three non-trivial case studies: i.e. updating Google Calendar API, switching from JDom to Dom4j, and switching from Swing to SWT. The result is encouraging; it shows that our language allows successful transformations of real world programs with a small number of rules and little manual resolution.
Thu 21 JulDisplayed time zone: Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna change
10:30 - 11:45 | |||
10:30 25mTalk | A Calculus for Variational Programming Research Track Sheng Chen University of Louisiana at Lafayette, Martin Erwig Oregon State University, Eric Walkingshaw Oregon State University Link to publication DOI Media Attached | ||
10:55 25mTalk | A Calculus with Partially Dynamic Records for Typeful Manipulation of JSON Objects Research Track Atsushi Ohori Tohoku University, Katsuhiro Ueno Tohoku University, Tomohiro Sasaki Tohoku University, Daisuke Kikuchi Tohoku University and Hitachi Solutions East Japan, Ltd. Link to publication DOI Pre-print Media Attached | ||
11:20 25mTalk | Transforming programs between APIs with Many-to-Many Mappings Research Track Chenglong Wang University of Washington, Jiajun Jiang Peking University, Jun Li Peking University, Yingfei Xiong Peking University, Xiangyu Luo Peking University, Lu Zhang Peking University, Zhenjiang Hu National Institute of Informatics Link to publication DOI Pre-print Media Attached |