Skip to content

False error in external specs: a @Ghost the constructor does not set gives "Ghost 'old' could not be found" at the next from-only call #450

Open

Description

@CatarinaGamboa

Impact: adding a @Ghost to an external spec breaks correct programs, unless every constructor sets the ghost. The error names a ghost called old, which is internal and not in the spec.

Minimal reproducer (an external spec and a client, in one directory)

// EditRefinements.java
@ExternalRefinementsFor("javax.swing.undo.AbstractUndoableEdit")
@StateSet({"done", "undone"})
@Ghost("int supported")
public interface EditRefinements {
    @StateRefinement(to = "done(this)")
    void AbstractUndoableEdit();

    @StateRefinement(from = "done(this)")
    boolean canUndo();
}

// Client.java
public class Client {
    public static void main(String[] args) {
        AbstractUndoableEdit e = new AbstractUndoableEdit();
        e.canUndo();
    }
}

Expected: Correct! Passed Verification.

Actual (main @ f7f366c, and 1a506fe):

Not Found Error: Ghost 'old' could not be found

The same shape written in-source (an annotated class with the same @Ghost) verifies. So does the external spec when the constructor's to also sets the ghost: to = "done(this) && supported(this) == 0".

Real-world scenario. I was writing a spec for javax.management.modelmbean.RequiredModelMBean with a ghost to refuse load()/store(), which always throw; from = "false" doesn't work (#449). With the ghost unset, every correct call such as m.setModelMBeanInfo(info) failed with this error.

Activity

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