Back to Search Start Over

Deprewriter: On the fly rewriting method deprecations

Authors :
Ducasse, Stéphane
Polito, Guillermo
Zaitsev, Oleksandr
Denker, Marcus
Tesone, Pablo
Analyses and Languages Constructs for Object-Oriented Application Evolution (RMOD)
Inria Lille - Nord Europe
Institut National de Recherche en Informatique et en Automatique (Inria)-Institut National de Recherche en Informatique et en Automatique (Inria)-Centre de Recherche en Informatique, Signal et Automatique de Lille - UMR 9189 (CRIStAL)
Centrale Lille-Université de Lille-Centre National de la Recherche Scientifique (CNRS)-Centrale Lille-Université de Lille-Centre National de la Recherche Scientifique (CNRS)
Centre de Recherche Réseau Image SysTème Architecture et MuLtimédia (CRISTAL)
École Nationale des Sciences de l'Informatique [Manouba] (ENSI)
Université de la Manouba [Tunisie] (UMA)-Université de la Manouba [Tunisie] (UMA)
Centre de Recherche en Informatique, Signal et Automatique de Lille - UMR 9189 (CRIStAL)
Centrale Lille-Université de Lille-Centre National de la Recherche Scientifique (CNRS)
Arolla
Pharo consortium
The work is supported by the I-Site ERC-Generator Multi project 2018-2022. We gratefully acknowledge the financial support of the Métropole Européenne de Lille CPER DATA3. The authors thank Arolla for funding Oleksandr Zaitsev. We thank the Pharo consortium for its support.
Source :
The Journal of Object Technology, The Journal of Object Technology, 2022, 21 (1), pp.1-23. ⟨10.5381/jot.2022.21.1.a1⟩
Publication Year :
2022
Publisher :
HAL CCSD, 2022.

Abstract

International audience; Deprecations are a common way to indicate that a given feature or API will not be available in subsequent versions of a library or framework. While raising deprecation warnings lets developers of libraries evolve their APIs, the developers of client applications often have to manually rewrite their applications to adapt to the deprecation (removal, new APIs.. .). Some may use static analysis tools to support the rewriting. However, dynamically-typed languages or the use of reflective features often produce incorrect rewrite candidates. This is a costly activity that can lead to bug introductions. In this article, we present a method deprecation approach and a tool called DEPREWRITER that can automatically rewrite the callers of deprecated methods during program execution. Clients of a deprecated API execute their program and associated tests, and DEPREWRITER dynamically rewrites the source code of methods that called a deprecated API to use the new API. The implementation of DEPREWRITER is based on dynamic program transformation: when a deprecated method is executed, a program transformation engine rewrites and recompiles the caller's code before continuing the execution. The approach presented in this article has been developed by the Pharo consortium. Since 2016, DEPREWRITER is used in production in multiple distributions of the Pharo programming language: Pharo 6, 7, 8, and 9 alpha. This article presents and validates this approach. The validation is done in two steps: first with an analysis of deprecations available in Pharo 8 and second with an open survey of software developers about DEPREWRITER. We studied 367 Pharo 8 deprecations, among which we analyzed the 218 rewriting deprecations that use transformation rules. We identified the validity conditions and reported defects to the community. We also proposed 33 transformation rules to be added to the non-rewriting deprecations. Both contributions were accepted into Pharo 9 alpha. We classified the rules and identified possible points of improvement. In addition, we performed a user survey and collected information from 46 software developers: some of them used existing DEPREWRITER' rules and executed them on their code, others used DEPREWRITER to create rewriting deprecations, and finally, some were not aware of DEPREWRITER. 28 of 46 developers (60%) reported that the rewriting deprecations helped them, while 10 stated the inverse and 8 were uncertain. After discussing the current implementation, we sketch possible implementations for other languages than Pharo, showing that the approach is general enough to be applied to other languages.

Details

Language :
English
ISSN :
16601769
Database :
OpenAIRE
Journal :
The Journal of Object Technology, The Journal of Object Technology, 2022, 21 (1), pp.1-23. ⟨10.5381/jot.2022.21.1.a1⟩
Accession number :
edsair.doi.dedup.....707cfdaa194df18d1856b401fe64b1fb