Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Reading a field of a class declared later in the file loses its refinement

Abierto
#316 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
62/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

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.

Lenguaje dominante
Java
Estrellas
67
Forks
36
Merge medio
4 d 17 h
PR fusionados (30 d)
7

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de liquid-java/liquidjava

Todos los issues de liquid-java/liquidjava

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.