Skip to content

Regression since the Spoon 11 upgrade: any record crashes the verifier #369

Description

@CatarinaGamboa

Since #363 (Spoon 10.4.2 -> 11.5.0), any record in the checked code crashes verification, even without refinements:

public record Point(int x, int y) {
    int sum() { return x + y; }
}

On main 9045ecd:

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.io.File.getAbsolutePath()" because the return value of "spoon.reflect.cu.SourcePosition.getFile()" is null
	at liquidjava.processor.refinement_checker.TypeChecker.scan(TypeChecker.java:74)
	at spoon.reflect.visitor.CtScanner.visitCtRecord(CtScanner.java:1065)

On be47cb6 (before the upgrade) it passes.

Cause: Spoon 11 dispatches records to visitCtRecord, not visitCtClass. ExternalRefinementTypeChecker skips classes (visitCtClass is empty) but not records, so it visits the record's methods with no external target (prefix is null): TypeFactory.createReference(null) throws. Reporting that error then fails too, because the record's implicit members have no source file, so TypeChecker.scan throws the NPE above instead of the real error.

Found re-checking our bank of real-bug examples on the new main (one of them is a record).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions