Description
Impact: with more than one @StateSet, Found, expected and the state hints name every state set, including the ones the failing call does not care about and the suggested call does not change. The one change that matters (unmarked to marked) is buried among states that stay the same.
Minimal reproducer
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
@StateSet({"open", "closed"})
@StateSet({"unmarked", "marked"})
class Stream {
@StateRefinement(to = "open(this) && unmarked(this)")
Stream() {}
@StateRefinement(to = "marked(this)")
void mark() {}
@StateRefinement(from = "marked(this) && open(this)")
void reset() {}
}
public class Probe {
static void run() {
Stream s = new Stream();
s.reset();
}
}Actual (main @ cd49fea):
State Refinement Error: found open(s⁷) && unmarked(s⁷) but expected marked(s⁷) && open(s⁷)
Hints:
- Call s.mark() before this call to move s from open and unmarked to open and marked
- In state open and unmarked, s can call: mark()
Expected: the hint names only the state set the call changes: Call s.mark() before this call to move s from unmarked to marked. Found and expected could likewise lead with the set that differs (found unmarked(s) but expected marked(s)), since open holds on both sides.
Real-world scenario. Two of the six exercises for the error-message study:
- Cytoscape FormatReaderManager: a fresh
BufferedInputStreamisreset()without amark()(IOException: Resetting to invalid mark). The message readsfound open(buffered) && unmarked(buffered) but expected marked(buffered) && open(buffered), and the hintmove buffered from open and unmarked to open and marked. - dcm4che SlideRecoder:
setCompressionTypebeforesetCompressionMode(MODE_EXPLICIT)(IllegalStateException: Compression mode not MODE_EXPLICIT!). The hint ismove wParam from tilingNotExplicit and compressionNotExplicit to tilingNotExplicit and compressionExplicit; tiling has nothing to do with the bug.
The hint text is built in StateHints (Call %s before this call to move %s from %s to %s).
Activity