Skip to content

Fix Field Initialization - #281

Merged
rcosta358 merged 2 commits into
mainfrom
fix-field-initialization
Aug 11, 2026
Merged

Fix Field Initialization#281
rcosta358 merged 2 commits into
mainfrom
fix-field-initialization

Conversation

@rcosta358

Copy link
Copy Markdown
Collaborator

Description

This PR makes constructors preserve state refinements when an object is assigned directly to a class field.
Field initializers were visited but their refinement metadata was not transferred to the field’s symbolic instance.

Example

public class Test {

    private final Obj obj = new Obj();

    public void test() {
        obj.foo(); // reports state refinement error but should pass
    }
}

@Ghost("boolean ready")
class Obj {

    @StateRefinement(to = "ready(this)")
    Obj() {}

    @StateRefinement(from = "ready(this)")
    void foo() {}
}

Related Issue

None.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Code refactoring

Checklist

  • Added/updated tests under liquidjava-example/src/main/java/testSuite/ (Correct* / Error*)
  • mvn test passes locally
  • Updated docs/README if behavior or API changed

@rcosta358 rcosta358 self-assigned this Aug 6, 2026
@rcosta358 rcosta358 added the bug Something isn't working label Aug 6, 2026
@rcosta358
rcosta358 force-pushed the fix-field-initialization branch from 4ddc546 to 74dfda1 Compare August 11, 2026 09:39
@rcosta358
rcosta358 changed the base branch from fix-npe-3 to main August 11, 2026 09:41
@rcosta358
rcosta358 merged commit 61d3a67 into main Aug 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants