Ghost variables are not correctly initialized in interfaces
@pcanelas 已經在處理了。
開始於 2025年7月4日。
評估
這個 Issue 還沒有評估資料。
描述
Ghost variable initialization is dependent on declaring the constructor for the type the that the refinements are for. This declaration implicitly initializes int variables in a way equivalent to @StateRefinement(to = "var(this) == 0")
It is not possible to declare constructors for interface types as these don't have constructors. This prohibits the correct initialization of both Ghost variables and States for interfaces
@ExternalRefinementsFor("java.util.List")
@Ghost("int size2")
public interface ListRefinements<E> {
@StateRefinement(to = "size2(this) == (size2(old(this)) + 1)")
public boolean add(E elem);
@StateRefinement(from = "size2(this) > 0", to = "size2(this) == (size2(old(this)) - 1)")
public void remove(@Refinement("index >= 0") int index);
}
public static void main(String[] args) {
List<Integer> l = new ArrayList<>();
l.add(0);
int a = l.remove(0);
}
The error provided is Failed to check state transitions when calling l.remove(0)
This error messages is identical to the error message that would appear when attempting the same operation on a concrete class without a declared constructor in the Refinement definitions
- 主要語言
- Java
- 星號
- 67
- 分支
- 36
- 平均合併
- 10 天 18 小時
- 30 天內合併 PR
- 3
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
liquid-java/liquidjava 的其他 Issue
-
enhancement
liquid-java/liquidjava#240 · 已指派 1 人 ·
-
enhancement ide
難度 3/5 1-2 天 新手友好度 45/100
liquid-java/liquidjava#206 ·
-
tests
難度 2/5 1-3 小時 新手友好度 25/100
liquid-java/liquidjava#198 ·
-
tests
難度 4/5 3-5 天 新手友好度 25/100
liquid-java/liquidjava#197 ·
-
tests
難度 4/5 3-5 天 新手友好度 35/100
liquid-java/liquidjava#196 · 2 則留言 ·
查看 liquid-java/liquidjava 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 65/100
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
elastic/gradle-plugins#157 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
cryptomator/hub#497 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
johanhaleby/occurrent#1120 ·