Abstract:
A native cross-platform mobile app has multiple platform-specific implementations. Typically, an app is developed for one platform and then ported to the remaining ones. ...Show MoreMetadata
Abstract:
A native cross-platform mobile app has multiple platform-specific implementations. Typically, an app is developed for one platform and then ported to the remaining ones. Translating an app from one language (e.g., Java) to another (e.g., Swift) by hand is tedious and error-prone, while automated translators either require manually defined translation rules or focus on translating APIs. To automate the translation of native cross-platform apps, we present j2SINFERER, a novel approach that iteratively infers syntactic transformation rules and API mappings from Java to Swift. Given a software corpus in both languages, j2SINFERER first identifies the syntactically equivalent code based on braces and string similarity. For each pair of similar code segments, j2SINFERER then creates syntax trees of both languages, leveraging the minimalist domain knowledge of language correspondence (e.g., operators and markers) to iteratively align syntax tree nodes, and to infer both syntax and API mapping rules. j2SINFERER represents inferred rules as string templates, stored in a database, to translate code from Java to Swift. We evaluated j2SINFERER with four applications, using one part of the data to infer translation rules, and the other part to apply the rules. With 76% in-project accuracy and 65% cross-project accuracy, j2SINFERER outperforms in accuracy j2swift, a state-of-the-art Java-to-Swift conversion tool. As native cross-platform mobile apps grow in popularity, j2SINFERER can shorten their time to market by automating the tedious and error prone task of source-to-source translation.
Published in: 2018 IEEE/ACM 5th International Conference on Mobile Software Engineering and Systems (MOBILESoft)
Date of Conference: 27 May 2018 - 03 June 2018
Date Added to IEEE Xplore: 22 November 2018
ISBN Information:
Conference Location: Gothenburg, Sweden