Unannotated methods of the same class: a parameter's state is unknown inside, and the method's effect is lost at the call site
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- compilers, testing-qa
Direzione di ricerca
Start with the two-file Java reproducer in the issue and trace how private same-class methods are checked and how their effects are propagated at call sites. Compare the reported error inside rewind with the missing error after rewind(br); also consider the described exception and initCause case. Done means the reproducer reports no error inside rewind and flags the second br.reset().
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Impact: a false error inside a helper, and a missed bug at its call site.
Description
A private (or otherwise unannotated) method of the same class that takes a typestate object as a parameter is checked as if the parameter could be in any state, and its effect on the argument is not applied at the call site. In the reproducer:
- inside
rewind,r.reset()is reported ("found true but expected marked(r)") although its only caller marks the reader first; - at the call site,
bris still taken to bemarkedafterrewind(br), so the secondbr.reset(), which throws at run time, is not reported.
The same applies to objects that reach a method by other ways the file shows, e.g. an exception thrown by a method of the same class and caught by its caller: the catch parameter's state is unknown, so every initCause on it is reported, whether or not the thrower had set a cause.
Minimal reproducer (two files)
import liquidjava.specification.ExternalRefinementsFor;
import liquidjava.specification.StateRefinement;
import liquidjava.specification.StateSet;
@ExternalRefinementsFor("java.io.BufferedReader")
@StateSet({"open", "marked", "closed"})
interface BufferedReaderRefinements {
@StateRefinement(to = "open(this)")
void BufferedReader(java.io.Reader in);
@StateRefinement(from = "open(this)")
@StateRefinement(from = "marked(this)")
String readLine();
@StateRefinement(from = "open(this)", to = "marked(this)")
@StateRefinement(from = "marked(this)")
void mark(int readAheadLimit);
@StateRefinement(from = "marked(this)", to = "open(this)")
void reset();
@StateRefinement(from = "!closed(this)", to = "closed(this)")
void close();
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
public class Repro {
static void read(Reader in) throws IOException {
BufferedReader br = new BufferedReader(in);
br.mark(100);
rewind(br);
br.reset(); // rewind() already reset br, so it is no longer marked: not reported
}
private static void rewind(BufferedReader r) throws IOException {
r.reset(); // reported: "found true but expected marked(r)", though every caller here marks r first
}
}
Expected: no error inside rewind (every caller passes a marked reader), and an error at the second br.reset() in read.
Actual:
State Refinement Error: found true but expected marked(r²⁴)
14 | r.reset(); // reported: "found true but expected marked(r)", though every caller here marks r first
and nothing at line 10.
Possible directions: a way to write the state a parameter needs and leaves (e.g. @StateRefinement(from = "marked(r)", to = "open(r)") on the method), and/or inferring it for private methods of the same class from their bodies and call sites.
- Lingua principale
- Java
- Stelle
- 73
- Fork
- 38
- Merge medio
- 12h 32m
- PR unite (30g)
- 45
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi 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
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
liquid-java/liquidjava#562 ·
I maintainer di solito rispondono entro 1 giorno
-
A float ghost crashes the verifier: "Ghost not implemented for type float"Forse già presa @MohammedZaid1740 l’ha presa 7 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
liquid-java/liquidjava#443 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug real-world-finding
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
liquid-java/liquidjava#395 ·
I maintainer di solito rispondono entro 1 giorno
-
A ternary between arrays crashes: Sorts (Array Int Int) and Bool are incompatibleForse già presa @CatarinaGamboa l’ha presa 4 giorni fa. Apertabug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 15/100
liquid-java/liquidjava#558 ·
I maintainer di solito rispondono entro 1 giorno
-
new T[a][b] gets length b instead of a (unsound)Forse già presa @CatarinaGamboa l’ha presa 4 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 30/100
liquid-java/liquidjava#557 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di liquid-java/liquidjava
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
quelea-projection/Quelea#749 ·
I maintainer di solito rispondono entro 1 giorno
-
free_port can hand one port to two callers, so the fixed-port http tests fail in parallel runsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#963 ·
I maintainer di solito rispondono entro 1 giorno
-
api-diagnostics bug jdbc
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
ClickHouse/clickhouse-java#3464 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 76/100
-
Deferred
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Sanne/incus-spawn#2768 ·
I maintainer di solito rispondono entro 1 giorno