Java edition
ClassMutator
interface in io.mutastic.api
non-sealed interface ClassMutator extends OperatorAn operator a plugin adds that changes a class as a whole, where a Mutator changes one
instruction: what no instruction holds, as an annotation on a class or a field, or a method
written anew. Plugins provide theirs as a java.util.ServiceLoader service, in a jar
mutastic.yaml lists under plugins:.
A mutant of one runs with every class loaded anew, as what reads an annotation may have kept what it read, and a class written anew may have methods the build’s doesn’t: swapping it into the class already loaded wouldn’t reach either. That costs a load of the classes, and whatever a test sets up on them, for each mutant.
Each mutant’s id is made from its member, its change’s label and the operator’s id, so a label must never change once released.
Methods
changes
List<ClassMutator.Change> changes(ClassModel owner)The changes this operator makes in owner, each by its member and label; none when it doesn’t
apply.
write
byte[] write(ClassModel owner, ClassMutator.Member member, String label)owner’s bytes with the change made. A change that doesn’t verify, or that throws an
IllegalArgumentException or IllegalStateException here, is skipped as unviable, never run.
words
Mutator.Words words(Mutant mutant)What a missed mutant’s card says.
prepare
default void prepare(Project project)Told of the project before any of its classes, for an operator that needs more than the class file: to compile against its classpath, or read its sources.
reach
default ClassMutator.Reach reach()Which tests a mutant runs against.
onCalls
default boolean onCalls()tier
default Operator.Tier tier()