Assessing Reflection Usage with Mutation Testing Augmented Analysis - EVREF
Communication Dans Un Congrès Année : 2024

Assessing Reflection Usage with Mutation Testing Augmented Analysis

Résumé

Reflection is a powerful tool that allows a program to manipulate itself during its execution. However, developers may use it to circumvent data encapsulation and method visibility modifiers. Thus, it is important to assess how much an application relies on reflection. Nonetheless, reflection is mostly incompatible with static analysis as it relies on runtime information (e.g., to determine the attribute to be accessed or the method to evaluate). These problems worsen with dynamically-typed languages, where reflective operations are polymorphic with non-reflective operations, e.g., in Pharo, array access is polymorphic with context variable modifications. In this paper, we present RAPIM, an approach to study the uses of reflective APIs: it uses mutation analysis with a new mutation operator for dealing with core reflective methods. We analyze a serialization library from a developer perspective, showing the information it reveals. We evaluate our approach on a selection of five projects by comparing its performance against static analysis. We show that out of five projects, RAPIM disambiguates more potentially reflective call-sites than the static analysis. When the code coverage is good, the percentage of disambiguation is three times higher. Finally, we question the relevance of polymorphism between non-reflective and reflective APIs. Out of five projects, only one uses it, for only 1.4% of potentially reflective call-sites. We argue that reflective APIs could be renamed to avoid ambiguities.
Fichier principal
Vignette du fichier
main.pdf (1.11 Mo) Télécharger le fichier
Origine Fichiers produits par l'(les) auteur(s)

Dates et versions

hal-04600101 , version 1 (13-08-2024)

Licence

Identifiants

  • HAL Id : hal-04600101 , version 1

Citer

Iona Thomas, Stéphane Ducasse, Guillermo Polito, Pablo Tesone. Assessing Reflection Usage with Mutation Testing Augmented Analysis. 21st International Conference on Software and Systems Reuse (ICSR 2024), Jun 2024, Limassol, Cyprus. ⟨hal-04600101⟩
59 Consultations
15 Téléchargements

Partager

More