Publication Type

Conference Proceeding Article

Version

publishedVersion

Publication Date

7-2019

Abstract

Developing software often requires code changes that are widespread and applied to multiple locations.There are tools for Java that allow developers to specify patterns for program matching and source-to-source transformation. However, to our knowledge, none allows for transforming code based on its control-flow context. We prototype Coccinelle4J, an extension to Coccinelle, which is a program transformation tool designed for widespread changes in C code, in order to work on Java source code. We adapt Coccinelle to be able to apply scripts written in the Semantic Patch Language (SmPL), a language provided by Coccinelle, to Java source files. As a case study, we demonstrate the utility of Coccinelle4J with the task of API migration. We show 6 semantic patches to migrate from deprecated Android API methods on several open source Android projects. We describe how SmPL can be used to express several API migrations and justify several of our design decisions.

Keywords

Program transformation, Java

Discipline

Software Engineering

Research Areas

Software and Cyber-Physical Systems

Publication

33rd European Conference on Object-Oriented Programming (ECOOP 2019), London, July 15-19: Proceedings

First Page

22:1

Last Page

27

ISBN

9783959771115

Identifier

10.4230/LIPIcs.ECOOP.2019.22

Publisher

Dagstuhl Publishing

City or Country

Dagstuhl

Copyright Owner and License

Authors

Creative Commons License

Creative Commons Attribution-Share Alike 4.0 International License
This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.

Additional URL

https://doi.org/10.4230/LIPIcs.ECOOP.2019.22

Share

COinS