Autorepairability

A New Software Quality Characteristic
Pongpop Lapvikai, Mahidol University
Yoshiki Higo, Osaka University
Chaiyong Ragkhitwetsagul, Mahidol University
Morakot Choetkiertikul, Mahidol University

SANER 2024 ERA Track

Lapvikai et al., Autorepairability, SANER 2024 ERA trackAutomated Program Repair (APR)
is a technique to remove exposed bugs fully
and automatically without
human intervention.

Lapvikai et al., Autorepairability, SANER 2024 ERA trackAutorepairability
We introduce a new software characteristic,
autorepairability,
which measures how effective APR techniques
are in a specific project.

Lapvikai et al., Autorepairability, SANER 2024 ERA track

Measuring Autorepairability
Step 1: Generates mutants of source code SP by using a mutation testing technique MU.
Each mutant µ M is a source code that is very similar to the given source code

∈Step 2: Applying APR tool A to mutants µ with test cases TP, a fix s is generated if it
passes all TP tests. Set S represents all solutions A can generate over all mutants in M.
Mutants passing all TP tests are not subjected to A.
Step 3: The technique calculates the ratio of the number of generated solutions |S| per
the number of mutants |M|, i.e., the AR-ability(SP , TP , M, A) score.

Lapvikai et al., Autorepairability, SANER 2024 ERA trackExperiment
We want to investigate whether methods with equivalent functionality have different
autorepairability (i.e., whether some implementations are easy to fix bugs with APR
techniques, while others are not?)We also aim to search for program elements that affect the autorepairability.

Lapvikai et al., Autorepairability, SANER 2024 ERA track

Research Questions
RQ1: What are the autorepairability scores of Java methods with functionalequivalence?
RQ2: What kinds of program elements affect autorepairability?

Lapvikai et al., Autorepairability, SANER 2024 ERA track

Methodology
Dataset : A set of 1,342 functional equivalent Java method pairs with test cases from
Higo et al. (2022).

Each pair passes the unit test cases of each other.

Lapvikai et al., Autorepairability, SANER 2024 ERA track

Methodology (cont.)
Mutation tool : A developed tool that generates mutants of the source code of a given
program based on PIT’s mutation operators.

APR tool : kGenProg, an APR tool of the generation-and-validation strategy.

Lapvikai et al., Autorepairability, SANER 2024 ERA trackResults: RQ1
Only 1,282 method pairs from Higo et al. (2022) can successfully be executed.

Lapvikai et al., Autorepairability, SANER 2024 ERA trackManual Investigation

Lapvikai et al., Autorepairability, SANER 2024 ERA trackResults: RQ2
Code structure 1: Usage of ternary operator (3 occurrences)

return s1.shortValue()<s2.shortValue() ? -1 :s1.shortValue()>s2.shortValue() ? 1: 0;

APR score = 0.60

if (o1.shortValue()<o2.shortValue()) return -1;
if (o1.shortValue()>o2.shortValue()) return 1;
return 0;

APR score = 0.09

Lapvikai et al., Autorepairability, SANER 2024 ERA trackResults: RQ2 (cont.)
Code structure 2: Combined logical expressions in a conditional statement(2 occurrences)

if (i >= 0x20 && i <= 0xD7FF)
return true;

if (c < 0x20) return false;
if (c <= 0xD7FF) return true;

APR score = 0.73

APR score = 0.13

Lapvikai et al., Autorepairability, SANER 2024 ERA trackImplications and Conclusion
We measured autorepairability of functional equivalent Java methods and compared
their autorepairability scores.
We manually investigated the selected pairs with high differences in autorepairability
scores and observed code constructs that may affect the autorepairability scores.

Introducing autorepairability to the characteristics of software quality
will lead to new research in the future.
Lapvikai et al., Autorepairability, SANER 2024 ERA track