feat(check): java public-class ⇄ file-name mismatch — layout finding with a ready jmove mv repair

- parser::java::class_name: exactly-one-public-top-level-type rule
  (package-info/module-info and 0-or-2-public files skipped)
- check gains name_mismatches[] (JSON, omitted when clean) + human lines;
  exit 2 covers both kinds; fix engine untouched by design — a file rename
  is not a byte edit, and mv keeps the FQN so no imports change
- output split into output/{mod,check} to stay under the 250-line rule
- e2e: reports Bad.java, stays quiet on Good.java, suggested rename makes
  check pass and preserves the file bytes
This commit is contained in:
loki5512344 2026-09-15 19:05:54 +02:00
parent c0b06efe57
commit f8004e669b
Signed by: boba
GPG key ID: 253067914055423B
12 changed files with 334 additions and 80 deletions

View file

@ -42,7 +42,7 @@ Rewrites happen first, the rename last; any failure rolls everything back.
```console
$ jmove check
check: no broken imports found
check: no findings
```
When something does point at nothing, `check` prints one line per broken

View file

@ -40,13 +40,16 @@ working tree unstaged either way — stage or commit them yourself.
`--json` reports the choice as `moved_via` (`"git"`/`"fs"`) and, on a
dry-run, `would_move_via`.
### check — find broken imports
### check — find broken imports and Java layout errors
```
jmove check [--root DIR] [--json]
```
Run after any move (or any edit) to validate project consistency.
Run after any move (or any edit) to validate project consistency. Reports
broken relative imports and Java files whose single public type is named
differently from the file (each finding carries the exact `jmove mv` that
renames it; exit code 2 covers both kinds).
### fix — auto-repair import problems
@ -119,7 +122,7 @@ and a `hint` describing the next action. On success, `mv` reports
- `0` — success
- `1` — operation failed (read `--json` error or stderr)
- `2` — `check` found broken imports
- `2` — `check` found broken imports or Java name mismatches
## Rules of use