Soundness: a to that sets another object's state drops the receiver's frame (x.observe(y) forgets x's state)

Aperta
#504 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Start by locating getMissingStates and trace how it checks whether a state set is mentioned in a method’s to refinement. Use the FrameOther example to verify that observe preserves the receiver’s state while constraining other. Done means the example no longer verifies an invalid call to close() after observe, while valid post-state constraints on this still work.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

Problem (soundness). getMissingStates keeps a state set of this unchanged only if to does not mention that set. A state counts as a mention whatever object it is applied to, so a method that changes another object's state forgets the receiver's state.

import liquidjava.specification.*;

@StateSet({"closed", "opened"})
public class FrameOther {
    @StateRefinement(to = "closed(this)")
    public FrameOther() {}

    @StateRefinement(from = "opened(this)", to = "closed(this)")
    public void close() {}

    @StateRefinement(to = "opened(other)")
    public void observe(FrameOther other) {}

    public static void main(String[] args) {
        FrameOther x = new FrameOther();
        FrameOther y = new FrameOther();
        x.observe(y);
        x.close(); // fine only if x is still closed is NOT required; close needs opened(x)
    }
}

This passes verification, but x is still closed when x.close() (from opened) is called. observe's to is opened(other). Because opened appears in it, state1(this) == state1(old(this)) is not added, so x's set is unconstrained after the call.

Fix. A set counts as mentioned only when to constrains it on the post-state receiver, this. That is a state or the set function applied to this, and not to old(this) or another object.

Found while designing #502.

Lingua principale
Java
Stelle
73
Fork
38
Merge medio
12h 32m
PR unite (30g)
45

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di liquid-java/liquidjava

Tutte le issue di liquid-java/liquidjava

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.