Skip to content

static final field plus a refinement gives a spurious "Invalid ghost declaration" #307

Description

@CatarinaGamboa

Description

A private static final int field used as an argument to a refined parameter produces a syntax error about ghost declarations, although the code declares no ghost.

Minimal reproducer

import liquidjava.specification.Refinement;

public class Repro {
    private static final int BUFFER = 64;

    static void use(@Refinement("_ > 0") int n) {}

    public static void main(String[] args) {
        use(BUFFER);
    }
}

Expected

Correct! Passed Verification. (BUFFER == 64 > 0).

Actual

Running LiquidJava on: <repro dir>

Syntax Error: Invalid ghost declaration, expected e.g. @Ghost("int size")

Reproduced on main at 8816186 (liquidjava-verifier 0.0.35), and on 0.0.33.

Context

Found while turning real open-source Java code into study examples for the error-message study: real code hits this constantly, so the examples have to be rewritten around it or cannot be verified. Named constants are the idiomatic way to write these values, so examples had to replace them with literals.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions