GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — External specs: a @StateSet declared later in the file is not found by an interface earlier in it · Issue #452 · liquid-java/liquidjava

External specs: a @StateSet declared later in the file is not found by an interface earlier in it #452

New issue
Copy link
New issue
Copy link
Closed
#508
Closed
External specs: a @StateSet declared later in the file is not found by an interface earlier in it#452
#508
Copy link

Description

@CatarinaGamboa
CatarinaGamboa
opened on Oct 29, 2026
Issue body actions

When one spec file holds external refinements for several classes of a hierarchy, the interface that declares the @StateSet has to come first in the file. If an interface earlier in the file uses the states, verification fails with Not Found Error: Ghost '...' could not be found, even though the declaration is in the same file. Declaration order should not matter.

Minimal reproducer

FrameRefinements.java:

import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;

@ExternalRefinementsFor("java.awt.Frame")
public interface FrameRefinements {
    @StateRefinement(to = "notDisplayable(this)")
    void Frame();

    @StateRefinement(from = "notDisplayable(this)")
    void setUndecorated(boolean undecorated);
}

@ExternalRefinementsFor("java.awt.Window")
@StateSet({"notDisplayable", "displayable"})     // declared here, after its first use above
interface WindowRefinements {
    @StateRefinement(to = "displayable(this)")
    void pack();
}

Client.java (correct code):

import java.awt.Frame;

public class Client {
    public static void main(String[] args) {
        Frame f = new Frame();
        f.setUndecorated(true);
        f.pack();
    }
}

Found:

Not Found Error: Ghost 'java.awt.Frame.notDisplayable' could not be found
    @StateRefinement(to = "notDisplayable(this)")

Expected: Correct! Passed Verification., as when the WindowRefinements interface is moved above FrameRefinements (nothing else changed).

Real-world scenario

Frame.setUndecorated throws IllegalComponentStateException: The frame is displayable. once the frame has a peer, and pack()/setVisible(true) (declared in java.awt.Window) create it. A spec for this, used to catch real bugs like calling setUndecorated(true) after pack() in a game window, needs interfaces for Window, Frame, Component and JFrame. The state must be declared on Window, since a state declared on Frame cannot be used by Window.pack() (expected Frame, got Window, which seems right). The natural order, with the class being specified first, then fails as above.

Verifier commit 1a506fe. Reproducer as a verifier probe: liquid-java/co-specification verifier-probes/V32_StateSetDeclaredLater.

Activity

  1. CatarinaGamboa
    added a commit that references this issue on Nov 9, 2026

    Register every ghost and state set before any spec is read (#508)

    This issue will close once commit 1b329ee is merged into the 'main' branch.
    1b329ee
  2. CatarinaGamboa
    closed this as completedin #508on Nov 9, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.