False error: @StateRefinement(from = "false") gives "State Conflict Error: Found multiple disjoint states"

未關閉
#449 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 2 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
java

研究方向

Start by reading the state transition validation path that reports “Found multiple disjoint states” and trace how it handles @StateRefinement(from = "false") in the reproducer. Check the existing tests for state refinements and add a case where the method is never called. Done means the spec verifies successfully while a call to unsupported() is rejected.

由索引模型根據 Issue 內容生成。

描述

Impact: there is no direct way to say "this call is never allowed". from = "false" should refuse the method in every state. Instead it makes the spec itself an error, even in programs that never call the method.

Minimal reproducer

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

@StateSet({"a", "b"})
class Res {
    @StateRefinement(to = "a(this)")
    public Res() {}

    @StateRefinement(from = "false")
    public void unsupported() {}

    public void fine() {}
}

public class Repro {
    public static void main(String[] args) {
        Res r = new Res();
        r.fine();          // unsupported() is never called
    }
}

Expected: Correct! Passed Verification. A call to unsupported() would then be refused.

Actual (main @ f7f366c, and 1a506fe):

State Conflict Error: Found multiple disjoint states in state transition: state transition can only go to one state of each state set
12 |     @StateRefinement(from = "false")

Real-world scenario. javax.management.modelmbean.RequiredModelMBean.load() and store() always throw MBeanException("Persistence not supported for this MBean") (RequiredModelMBean.java:372-378, 414-420), so a spec should refuse them everywhere. Barista's expert spec allows them, so the bug goes unreported.

Workaround: an int ghost that no call sets, with the constructor setting it to 0 (from = "supported(this) == 1"). It works, but it's an odd thing to have to write.

主要語言
Java
星號
71
分支
37
平均合併
1 天 19 小時
30 天內合併 PR
46

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

liquid-java/liquidjava 的其他 Issue

查看 liquid-java/liquidjava 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。