⚡ Sangsakala Proxy 🏠 Home
Skip to content

State messages and hints name every state set, including ones the call does not change #482

Closed

Description

@CatarinaGamboa

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 BufferedInputStream is reset() without a mark() (IOException: Resetting to invalid mark). The message reads found open(buffered) && unmarked(buffered) but expected marked(buffered) && open(buffered), and the hint move buffered from open and unmarked to open and marked.
  • dcm4che SlideRecoder: setCompressionType before setCompressionMode(MODE_EXPLICIT) (IllegalStateException: Compression mode not MODE_EXPLICIT!). The hint is move 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    error messagesRelated to error messagesstudyNeeded before the error-message user study

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions