Skip to content
mutastic

Mutant

record in io.mutastic.api

record Mutant(
String className,
String methodName,
String descriptor,
int ordinal,
int line,
Operator operator,
String original,
String replacement,
Optional<String> skipped,
List<Integer> copies,
List<String> operands)

One mutation of one instruction: which method, which mutation site in it (counted in bytecode order), and what the instruction becomes. A skipped mutant never runs: the change can’t be told apart from the original, or it’s code no test is meant to pin.

Components

classNamethe class’s internal name, com/example/Pricing
ordinalwhich site in the method, counted per kind of site: every arithmetic, branch and return instruction counts as an instruction site, and every call as a call site, whichever operators apply, so a new operator never shifts the ids of existing mutants
originalthe instruction: an opcode, IF_ICMPLT, or a call, INVOKEVIRTUAL com/example/Audit.record(Ljava/lang/String;)V
replacementwhat it becomes: IF_ICMPLE, return default or remove call
skippedwhy it doesn’t run, equivalent: already returns the default, if it doesn’t
copiesmore sites (of the same kind) that get the same change at the same time: the copies javac makes of a finally block, one per way out of the try
operandswhat the instruction works on, as the source names it (total, 100), when the bytecode before it says; not part of the fingerprint

Constructors

Mutant

Mutant(String className, String methodName, String descriptor, int ordinal, int line, Operator operator, String original, String replacement, Optional<String> skipped, List<Integer> copies)

A mutant whose operands aren’t known.

Mutant

Mutant(String className, String methodName, String descriptor, int ordinal, int line, Operator operator, String original, String replacement, Optional<String> skipped)

A mutant of one site.

Methods

skippedFor

Mutant skippedFor(String reason)

The same mutant, skipped for reason (user: …).

unskipped

Mutant unskipped()

The same mutant, to run: for an audit of what a filter skips.

changes

boolean changes(int site)

Whether the change is made at site (counted in this mutant’s kind of site).

fingerprint

String fingerprint()

Stable across runs and line moves: class, method, site and replacement, and the operator for all but the first five (BuiltIn#first), but no line number, because code moves during review far more often than it changes. A finally block’s copies share the first copy’s fingerprint.

id

String id()

m11989fc0: what people type.

binaryName

String binaryName()

com.example.Pricing.