Skip to content

refactor: migrate Xtend to Java - com.avaloq.tools.ddk.check.core#1452

Draft
joaodinissf wants to merge 3 commits into
dsldevkit:masterfrom
joaodinissf:migrate/xtend-to-java/check-core
Draft

refactor: migrate Xtend to Java - com.avaloq.tools.ddk.check.core#1452
joaodinissf wants to merge 3 commits into
dsldevkit:masterfrom
joaodinissf:migrate/xtend-to-java/check-core

Conversation

@joaodinissf

@joaodinissf joaodinissf commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates the last 8 .xtend files of com.avaloq.tools.ddk.check.core — the production Check framework — to Java 21, a two-step rename→translate structure plus a final commit dropping the module's Xtend build infrastructure:

File Nature
CheckGeneratorConfig config bean
CheckGeneratorNaming naming helpers
CheckTypeComputer type computation
CheckScopeProvider scoping
CheckFormatter formatting2 (47-branch dispatcher preserved verbatim)
CheckGeneratorExtensions generator helpers (feeds emitted text)
CheckGenerator HTML docs / IssueCodes / StandaloneSetup / ServiceRegistry emitter
CheckJvmModelInferrer JVM model inference for check validators

Reviewing tip: the PR is structured as rename → translate: commit 1 is a pure git mv of the .xtend sources to .java (100% similarity, so git log --follow/git blame permanently traverse the migration), commit 2 rewrites them in place. Review commit 2 on the Commits tab to get a side-by-side Xtend-vs-Java diff per file; the aggregate Files-changed tab pairs only the near-transliterations. Commit 1 intentionally does not compile on its own.

The three byte-critical emitters keep the exact StringConcatenation call sequences of the Xtend compiler's own output (xtend-gen), including two-arg append(value, indent) and newLineIfNotEmpty() semantics — generated artifacts are byte-identical.

Infrastructure cleanup (module now fully off Xtend, matching the other migrated modules): xtend-gen/ removed from build.properties and .classpath, xtextBuilder/xtextNature removed from .project, xtend-gen/ directory deleted. No Require-Bundle change: the module declares no Xtend bundles; xtend2.lib/xbase.lib resolve transitively for the StringConcatenation-based generators, which remain by design.

Verification

  • Per-file adversarial verification against a fresh xtend-gen ground-truth build: append-for-append comparison plus executable byte-equality harnesses (real StringConcatenation, batteries covering empty/single-/multi-line/quotes/%/unicode inputs) for all templates of the three emitters — all IDENTICAL (~150 harness cases).
  • Dispatcher fidelity: instanceof-chain order diffed against xtend-gen — identical for all dispatchers (incl. the 47-branch CheckFormatter.format).
  • Full local gate: clean verify checkstyle:check pmd:check spotbugs:check (PMD 7.26.0) → BUILD SUCCESS, 0 violations, 357 tests, 0 failures, 0 errors — identical to the pre-migration baseline on the same tree (one pre-existing SWTBot flake, testBulkApplyingQuickfix, appeared in a later re-run and is unrelated).
  • Generation golden tests (IssueCodeToLabelMapGenerationTest, IssueCodeValueTest) green; no drift in any committed generated artifact.

Faithfulness notes

  • Xtend += null-safety restored in CheckJvmModelInferrer: Xtend's += silently skips null; the plain Iterables.addAll translation let null JvmMembers reach the type resolver (IllegalArgumentException: element: null, reproduced by the CheckValidationTest severity-range stubs). The two affected call sites are wrapped in IterableExtensions.filterNull, like every sibling site.

Deliberate deviations (output-neutral)

  1. Explicit StandardCharsets.UTF_8 in CheckGeneratorExtensions.getContents instead of the platform-default charset. Identical behavior on Java 18+ (JEP 400); the sole caller reads the service-registry file, which contains only ASCII fully-qualified class names, so emitted output is provably unchanged under any default charset.
  2. IllegalStateException wrapping of checked exceptions there instead of Xtend's sneaky-throw. Differs only in the thrown type on I/O failure (the build fails either way); no effect on generated output.
  3. .formatted() replaces the String.format the Xtend compiler emitted in splitCamelCase (repo convention; behavior-identical).
  4. Completed Javadoc (@param/@return) on CheckGeneratorNaming/CheckGenerator methods whose originals carried plain block comments — required by the checkstyle JavadocMethod gate once the comments became Javadoc.

🤖 Generated with Claude Code

@joaodinissf joaodinissf force-pushed the migrate/xtend-to-java/check-core branch from 0a18923 to 0f48915 Compare July 6, 2026 11:31
joaodinissf and others added 3 commits July 6, 2026 12:36
Pure git mv of the 8 remaining .xtend sources to .java, content
unchanged, so the rename edge has 100% similarity and git log --follow
and git blame permanently traverse the migration boundary. This
intermediate commit intentionally does not compile; the translation
follows in the next commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
In-place translation of the 8 renamed sources, faithful to the Xtend
compiler's own xtend-gen output (fresh ground-truth build). The three
byte-critical emitters (CheckGeneratorExtensions, CheckGenerator,
CheckJvmModelInferrer) keep the exact StringConcatenation call
sequences incl. two-arg append(value, indent) and newLineIfNotEmpty.

Notable per-file points:
- CheckJvmModelInferrer: Xtend's JvmTypesBuilder '+=' silently skips
  null elements; the plain Iterables.addAll translation let null
  JvmMembers reach the type resolver (IllegalArgumentException:
  element: null, reproduced by the CheckValidationTest severity-range
  stubs). The two affected call sites are wrapped in
  IterableExtensions.filterNull like every sibling site.
- CheckGeneratorExtensions.getContents: two deliberate output-neutral
  hardenings (explicit UTF-8; IllegalStateException wrapping of checked
  exceptions), documented in the PR.
- splitCamelCase uses .formatted() per repo convention
  (behavior-identical to the String.format xtend-gen emitted).
- CheckGeneratorNaming/CheckGenerator: Javadoc completed with
  @param/@return where originals carried plain block comments
  (checkstyle JavadocMethod gate).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The module is fully off Xtend: remove the xtend-gen source folder from
build.properties and .classpath, the xtextBuilder/xtextNature from
.project, and the xtend-gen directory marker — matching the other fully
migrated modules. No Require-Bundle change needed (the module declares
no Xtend bundles; xtend2.lib/xbase.lib resolve transitively for the
StringConcatenation-based generators).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant