Semantic Patches for Java Program Transformation (Experience Report)

Hong Jin Kang, Ferdian Thung, J. Lawall, Gilles Muller, Lingxiao Jiang, D. Lo
{"title":"Semantic Patches for Java Program Transformation (Experience Report)","authors":"Hong Jin Kang, Ferdian Thung, J. Lawall, Gilles Muller, Lingxiao Jiang, D. Lo","doi":"10.4230/LIPIcs.ECOOP.2019.22","DOIUrl":null,"url":null,"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.","PeriodicalId":172012,"journal":{"name":"European Conference on Object-Oriented Programming","volume":"32 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2019-07-15","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"12","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"European Conference on Object-Oriented Programming","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.4230/LIPIcs.ECOOP.2019.22","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 12

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.
Java程序转换的语义补丁(体验报告)
开发软件通常需要广泛地、应用于多个位置的代码更改。有一些Java工具允许开发人员指定程序匹配和源到源转换的模式。然而,据我们所知,没有一个允许基于其控制流上下文转换代码。我们原型化了Coccinelle4J,这是Coccinelle的扩展,它是一个程序转换工具,专为C代码中的广泛更改而设计,以便在Java源代码上工作。我们调整了Coccinelle,使其能够将语义补丁语言(Semantic Patch Language,一种由Coccinelle提供的语言)编写的脚本应用于Java源文件。作为一个案例研究,我们通过API迁移任务演示了Coccinelle4J的实用程序。我们展示了6个语义补丁,用于从几个开源Android项目中已弃用的Android API方法迁移。我们描述了如何使用SmPL来表达几种API迁移,并证明我们的一些设计决策是正确的。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信