You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
External specs: a @StateSet declared later in the file is not found by an interface earlier in it #452
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:
importliquidjava.specification.ExternalRefinementsFor;
importliquidjava.specification.StateRefinement;
importliquidjava.specification.StateSet;
@ExternalRefinementsFor("java.awt.Frame")
publicinterfaceFrameRefinements {
@StateRefinement(to = "notDisplayable(this)")
voidFrame();
@StateRefinement(from = "notDisplayable(this)")
voidsetUndecorated(booleanundecorated);
}
@ExternalRefinementsFor("java.awt.Window")
@StateSet({"notDisplayable", "displayable"}) // declared here, after its first use aboveinterfaceWindowRefinements {
@StateRefinement(to = "displayable(this)")
voidpack();
}
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