smarter stop method 'constant'
arnobl opened this issue · 6 comments
Characteristics
- Issue Type: [feature]
- Reproducibility: [always]
- Severity: [feature]
- Tool/Service/Component: [descartes/constant, 1.2.7-SNAP]
- Execution Environment: [j11, linux]
Description
The stop method 'constant' sometimes creates a mutant that returns the exact same value of the returned constant. I face this limitation in abstract classes that have some methods with default behavior (eg https://github.com/interacto/interacto-java-api/blob/master/src/main/java/io/github/interacto/binding/WidgetBindingImpl.java#L243). The method returns false and Descartes creates a mutant that returns true
while it should just create a mutant that returns false
.
Do you think that is possible to improve that?
Steps to reproduce
Create a method that returns true.
Enable except[constant]
Actually, no mutant should be created for this method. so this is indeed a bug.
Really? (I activated the 'constant' mutation)
I guess one mutant should be created: return true;
when the method returns the constant false
(and vise versa). No?
With except
you actually disable the constant
stop method.
So that's why these mutants are created.
I understand now what you mean.
With constant
we disable all methods returning a constant value no matter the type or the value.
But yes, maybe a smarter feature could be implemented.
well this is what I though when I read to documentation but this actually activate the mutants:
https://github.com/STAMP-project/pitest-descartes/blob/master/README.md#configuring-stop-methods
The doc says:
<features>
<feature>
<!-- This will allow descartes to mutate deprecated methods -->
+STOP_METHODS(except[deprecated])
</feature>
</features>
and indeed I activated several mutation operators this way.
Yes, sure, you activate the mutants by disabling the stop methods. Sorry I might not have been clear enough.
So having constant
activated, which is the default configuration, you avoid these mutants. except[constant]
allows the creation. so you are right.
Yes, sure, you activate the mutants by disabling the stop methods.
ok! I think you can add this sentence in the readme file.