Ghost variables are not correctly initialized in interfaces
@pcanelas ci sta già lavorando.
Dal 4/7/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
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
- Lingua principale
- Java
- Stelle
- 67
- Fork
- 36
- Merge medio
- 10g 18h
- PR unite (30g)
- 3
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di liquid-java/liquidjava
-
enhancement
liquid-java/liquidjava#240 · 1 assegnatario ·
-
enhancement ide
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
liquid-java/liquidjava#206 ·
-
tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 25/100
liquid-java/liquidjava#198 ·
-
tests
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
liquid-java/liquidjava#197 ·
-
tests
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
liquid-java/liquidjava#196 · 2 commenti ·
Tutte le issue di liquid-java/liquidjava
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Two open-case totals on one screen: the Programs tile says 15,858 and the nav badge says 15,868 Apertabug frontend maui-pilot
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
objectionary/eo-graphs#74 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100