Reading a field of a class declared later in the file loses its refinement
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 62/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- java
- Ambito
- compilers, testing-qa
Direzione di ricerca
Start with RefinementTypeChecker.visitCtField and visitCtFieldRead, which the issue identifies as the source-order context handling path. Use the supplied ReadBefore reproducer to confirm the false “not enough information” error, then compare it with the version where Job is declared earlier. Done means the reproducer reports “Correct! Passed Verification.” and reads still work when the class is declared later.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Reading a field of an object whose class is declared later in the file does not pick up the field's refinement, so a correct program fails with a false "not enough information" error. Writes to such fields are handled by #314 (fixing #308); reads are not.
Minimal reproducer
import liquidjava.specification.Refinement;
public class ReadBefore {
private final Job job = new Job();
@Refinement("_ >= 0")
public int get() { return job.port; }
static class Job { @Refinement("_ >= 0") int port; }
}
Expected
Correct! Passed Verification.
Actual
Refinement Error: true is not a subtype of #ret² >= 0
5 | public int get() { return job.port; }
| ^^^^^^^^^^^^^^^^
--> Not enough information to prove the expected refinement. Add a refinement or condition to constrain it.
Moving Job above get makes it pass.
Cause
Fields enter the context only in the second pass (RefinementTypeChecker.visitCtField), in source order. When job.port is read, this#port is not in context yet, so visitCtFieldRead falls through to new Predicate() (no information).
Reproduced on main at fbfb4e23 (liquidjava-verifier 0.0.35), and on the #314 branch.
- Lingua principale
- Java
- Stelle
- 67
- Fork
- 36
- Merge medio
- 4g 17h
- PR unite (30g)
- 7
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
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
liquid-java/liquidjava#321 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
liquid-java/liquidjava#323 ·
I maintainer di solito rispondono entro 2 giorni
-
Soundness: a field of another class or object is read as this class's field with the same nameApertabug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
liquid-java/liquidjava#322 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
liquid-java/liquidjava#318 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
liquid-java/liquidjava#317 ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di liquid-java/liquidjava
Issue simili
-
Update license yearAperta0 - Backlog 1 - Ready documentation good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
cbor
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
FasterXML/jackson-dataformats-binary#844 ·
I maintainer di solito rispondono entro 1 giorno
-
Issue: Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
OpenAPITools/openapi-generator#25107 ·
I maintainer di solito rispondono entro 1 giorno
-
improvement
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/iceberg#18351 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
repowise-dev/repowise#2945 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno