GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Skip records in the external-spec pass by CatarinaGamboa · Pull Request #370 · liquid-java/liquidjava

Conversation

@CatarinaGamboa

@CatarinaGamboa CatarinaGamboa commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

Fixes #369.

Problem

Since #363 (Spoon 11), any record crashed verification with an NPE in TypeChecker.scan. Spoon 11 dispatches records to visitCtRecord; ExternalRefinementTypeChecker overrides only visitCtClass (to skip user classes), so it walked the record's methods with prefix == null and createReference(null) threw. Building the error message then failed on the record's implicit members, which have no source file.

Change

  • ExternalRefinementTypeChecker.visitCtRecord: skip, as for classes.
  • TypeChecker.scan: when the failing element has no source file, the message says so instead of throwing an NPE.

With this, record methods are verified: a refinement violation inside a record method is reported (related to #342).

Tests

  • CorrectRecord: a record with a method calling a refined method correctly; crashed on main, now passes.
  • ErrorRecordMethod: a violation in a record method is reported.
  • mvn test passes.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@CatarinaGamboa @claude
Skip records in the external-spec pass
33acc4e
Fixes #369. Since the Spoon 11 upgrade, records reach visitCtRecord instead of
visitCtClass, so ExternalRefinementTypeChecker visited a record's methods with
no external target and crashed. It now skips records as it skips classes.
TypeChecker.scan also reports elements without a source file instead of
failing on their position.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@CatarinaGamboa
CatarinaGamboa requested a review from rcosta358 October 8, 2026 11:02
@CatarinaGamboa
CatarinaGamboa merged commit 5013598 into main Oct 8, 2026
1 check passed

Uh oh!

There was an error while loading. Please reload this page.

@CatarinaGamboa CatarinaGamboa mentioned this pull request Oct 13, 2026
Add regression tests for records verified with an external spec #394
Merged
@rcosta358
rcosta358 deleted the fix/record-implicit-members branch October 13, 2026 16:57
CatarinaGamboa added a commit that referenced this pull request Oct 14, 2026
@CatarinaGamboa @claude
Add regression tests for records verified with an external spec (#394)
1c6807b
Fixes #342 (regression tests only; no verifier change).

At the commit in the issue, `CommandLineLauncher` hard-coded compliance
level 8. Java 8 has no records, so JDT parsed the record header as a
method and its members as locals and a block; the real method was never
in the model. Spoon reports this as a warning in noclasspath mode, so
the run printed "Java compilation encountered issues" and then "Correct!
Passed Verification." It is already fixed on main by #352 (compliance
from the pom), #368 (default level 21, Spoon 11.5.0) and #370 (records
in the external-spec pass). Forcing level 11 or 15 still reproduces it;
16 and above report the error.

Fixtures, with the spec in its own file as in real projects:
- `classes/record_external_spec_error/`: State Refinement Errors in a
record's instance and static methods.
- `classes/record_external_spec_correct/`: the passing counterpart.

Related gaps found while investigating, not fixed here:
1. **A parse problem still ends in "Correct!" with only a warning.** If
Spoon's level is lower than the code needs, declarations can disappear
silently. `ComplianceLevel` reads only `maven.compiler.release`/`source`
properties of the nearest pom that has one, and ignores
`<release>`/`<source>` in the maven-compiler-plugin configuration, so a
parent property of 1.8 overridden in plugin config makes records vanish
again. Options: let that warning block the "Correct!" verdict, and read
the compiler-plugin config.
2. **One error hides later ones.** An error in a field initializer or
initializer block stops checking of the rest of the class (catch in
`visitCtClass`). `visitCtRecord` and `visitCtEnum` have no catch, so an
error in a record or enum static initializer reaches
`RefinementProcessor.processPackage` and later types in the package go
unchecked. Per-member catches like those in
`visitCtMethod`/`visitCtConstructor` would fix it.
3. **Test harness:** `TestExamples.matches` throws a
NullPointerException on a warning with no position (such as the
compilation warning).

Validation: `mvn test` passes all 412 tests (251 TestExamples cases).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rcosta358 rcosta358 Awaiting requested review from rcosta358

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

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

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@CatarinaGamboa
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.