skip to main content
10.1145/2678015.2682534acmconferencesArticle/Chapter ViewAbstractPublication PagespepmConference Proceedingsconference-collections
research-article

SWIN: Towards Type-Safe Java Program Adaptation between APIs

Published: 13 January 2015 Publication History

Abstract

Java program adaptation between different APIs is a common task in software development. When an old API is upgraded to an incompatible new version, or when we want to migrate an application from one platform to another platform, we need to adapt programs between different APIs. Although different program transformation tools have been developed to automate the program adaptation task, no tool ensures type safety in transforming Java programs: given a transformation program and any well-typed Java program, the transformed result is still well-typed. As a matter of fact, it is often observed that a dedicated adaptation tool turns a working application into a set of incompatible programs. We address this problem by providing a type-safe transformation language, SWIN, for Java program adaptation between different APIs. SWIN is based on Twinning, a modern transformation language for Java programs. SWIN enhances Twinning with more flexible transformation rules, formal semantics, and, most importantly, full type-safe guarantee. We formally prove the type safety of SWIN on Featherweight Java, a known minimal formal core of Java. Our experience with three case studies shows that SWIN is as expressive as Twinning in specifying useful program transformations in the case studies while guaranteeing the type safety of the transformations.

References

[1]
M. Nita and D. Notkin. Using twinning to adapt programs to alternative APIs, in: Proc. ICSE, 2010.
[2]
T. Bartolomei, K. Czarnecki, and R. Lammel. Swing to SWT and Back: patterns for API migration by wrapping, in: Proc. ICSM, 2010.
[3]
D. Dig, S Negara, and R. Johnson. ReBA: refactoring-aware binary adaptation of evolving libraries, in: Proc. ICSE, 2008.
[4]
J. Henkel and A. Diwan. CatchUp!: capturing and replaying refactorings to support API evolution, in: Proc. ICSE, 2005.
[5]
D. Dig, C. Comertoglu, D. Marinov, and R. Johnson. Automated detection of refactorings in evolving components, in: Proc. ECOOP, 2006.
[6]
H. Nguyen, T. Nguyen, G. Jr, A. Nguyen, M. Kim, and T. N. Nguyen. A graph-based approach to API usage adaptation, in: Proc. OOPSLA, 2010.
[7]
A. Igarashi, B. C. Pierce, and P. Wadler. Featherweight Java: a minimal core calculus for Java and GJ, ACM Trans. Program. Lang. Syst, 2001.
[8]
Y. Padioleau, J. Lawall, R. R Hansen, and G. Muller. Documenting and automating collateral evolutions in linux device drivers, in: Eurosys, 2008.
[9]
J. Andersen and J. L. Lawall. Generic patch inference, in: Proc. ASE, 2008.
[10]
N. Meng, M. Kim, and K. S. Mckinley. Systematic editing: generating program transformations from an example, in: Proc. PLDI, 2011.
[11]
J. R. Cordy. The TXL source transformation language, Science of Computer Programming, 2006.
[12]
E. Visser. Program transformation in stratego/xt: rules, strategies, tools and systems in stratego xt/0.9, Domain Specific Program Generation, 2004.
[13]
E. Balland, P. Brauner, R. Kopetz, P.-E. Moreau, and A. Reilles. Tom: piggybacking rewriting on Java, in: Proc. RTA, 2007.
[14]
I. Balaban, F. Tip, and R. Fuhrer. Refactoring support for class library migration, in: Proc. OOPSLA, 2005.
[15]
M. Erwig and D. Ren. A rule-based language for programming software updates, SIGPLAN Notices., 2002.
[16]
M. Erwig and D. Ren. An update calculus for expressing type-safe program update, Science of Computer Programming, 2007.
[17]
S. Leather, J. Jeuring, A. Loh, and B. Schuur. Type-changing rewriting and semantics-preserving transformation, in: Proc. PEPM, 2014.
[18]
E. W. Axelsen and S. Krogdahl. Package templates: a definition by semantic-preserving source-to-source transformations to efficient Java code, in: Proc. GPCE, 2012.
[19]
J. Li, Y. Xiong, X. Liu, and L. Zhang. How does web service API evolution affect clients', in: Proc. ICWS, 2013.
[20]
E. Visser. A survey of strategies in rule-based program transformation systems, Journal of Symbolic Computation, 2005.
[21]
M. Pilgrim. Dive into Python 3, 2nd edition, APress, 2009.
[22]
B. E. Cossette and R. J.Walker. Seeking the ground truth: a retroactive study on the evolution and migration of software libraries, in: Proc. FSE, 2012.
[23]
C. Wang, J. Li, Y. Xiong, and Z. Hu. Formal Definition of SWIN language, Technical Note, available at https: // github. com/ Mestway/ SWIN-Project/ blob/ master/ docs/ pepm-15/ TR/ TR. pdf, 2014.
[24]
Q. Wu, G. Liang, Q. Wang, and H. Mei. Mining Effective Temporal Specifications from Heterogeneous API Data, Journal of Computer Science and Technology, 2011.
[25]
N. Nystrom, M. R. Clarkson, and A. C. Myers. Polyglot: an extensible compiler framework for Java, in: Proc. CC, 2003.
[26]
R. Pawlak, C. Noguera, and N. Petitprez. Spoon: program analysis and transformation in Java, Technical Report 5901, INRIA, 2006.
[27]
S. A. Spoon. Fined-grained API evolution for method deprecation and anti-deprecation, in: Proc. FOOL, 2006.
[28]
L. Wasserman. Scalable, example-based refactorings with refaster, in: Proc. WRT, 2013.
[29]
B. Pierce. Types and Programming Languages, MIT Press, 2002.

Cited By

View all
  • (2024)Mapping APIs in Dynamic-typed Programs by Leveraging Transfer LearningACM Transactions on Software Engineering and Methodology10.1145/364184833:4(1-29)Online publication date: 18-Apr-2024
  • (2023)Hybrid API Migration: A Marriage of Small API Mapping Models and Large Language ModelsProceedings of the 14th Asia-Pacific Symposium on Internetware10.1145/3609437.3609466(12-21)Online publication date: 4-Aug-2023
  • (2022)Inferring and applying type changesProceedings of the 44th International Conference on Software Engineering10.1145/3510003.3510115(1206-1218)Online publication date: 21-May-2022
  • Show More Cited By

Index Terms

  1. SWIN: Towards Type-Safe Java Program Adaptation between APIs

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    PEPM '15: Proceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation
    January 2015
    152 pages
    ISBN:9781450332972
    DOI:10.1145/2678015
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    In-Cooperation

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 13 January 2015

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. api adaptation
    2. program transformation
    3. transformation language
    4. type safety

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    POPL '15
    Sponsor:

    Acceptance Rates

    PEPM '15 Paper Acceptance Rate 14 of 27 submissions, 52%;
    Overall Acceptance Rate 66 of 120 submissions, 55%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)6
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 02 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Mapping APIs in Dynamic-typed Programs by Leveraging Transfer LearningACM Transactions on Software Engineering and Methodology10.1145/364184833:4(1-29)Online publication date: 18-Apr-2024
    • (2023)Hybrid API Migration: A Marriage of Small API Mapping Models and Large Language ModelsProceedings of the 14th Asia-Pacific Symposium on Internetware10.1145/3609437.3609466(12-21)Online publication date: 4-Aug-2023
    • (2022)Inferring and applying type changesProceedings of the 44th International Conference on Software Engineering10.1145/3510003.3510115(1206-1218)Online publication date: 21-May-2022
    • (2022)A3: Assisting Android API Migrations Using Code ExamplesIEEE Transactions on Software Engineering10.1109/TSE.2020.298839648:2(417-431)Online publication date: 1-Feb-2022
    • (2021)Understanding Software-2.0ACM Transactions on Software Engineering and Methodology10.1145/345347830:4(1-42)Online publication date: 23-Jul-2021
    • (2020)Understanding type changes in JavaProceedings of the 28th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3368089.3409725(629-641)Online publication date: 8-Nov-2020
    • (2019)TransDroidProceedings of the 11th Asia-Pacific Symposium on Internetware10.1145/3361242.3361255(1-8)Online publication date: 28-Oct-2019
    • (2019)Type migration in ultra-large-scale codebasesProceedings of the 41st International Conference on Software Engineering10.1109/ICSE.2019.00117(1142-1153)Online publication date: 25-May-2019
    • (2019)Inferring program transformations from singular examples via big codeProceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering10.1109/ASE.2019.00033(255-266)Online publication date: 10-Nov-2019
    • (2018)Type migration in large-scale code basesProceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering10.1145/3236024.3275434(965-967)Online publication date: 26-Oct-2018
    • Show More Cited By

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media