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

What

Migrates the remaining 8 .xtend files of com.avaloq.tools.ddk.check.core to Java 21 (generator, generator-extensions, generator-naming, JVM model inferrer, formatter, scope provider, type computer, generator-config), and drops the module's Xtend build infrastructure. Commit structure follows the skill: pure git mv rename → in-place translate → infrastructure cleanup.

How it was validated

Beyond the standard build, this migration was independently re-migrated blind (a second migration produced from the .xtend sources + a freshly built xtend-gen ground truth, without looking at this branch's Java) and then three-way reconciled — blind vs this branch vs the xtend-gen compiler output as arbiter:

  • 3 of 8 files came out byte-identical between the two independent migrations (CheckTypeComputer, CheckGeneratorNaming, CheckScopeProvider) — mutual validation.
  • Every contested translation was adjudicated against xtend-gen and held up: the UTF-8 charset in getContents (PMD RelianceOnDefaultCharset requires an explicit charset), the filterNull wrappers in the inferrer (load-bearing — they reproduce JvmTypesBuilder.operator_add's null-skipping semantics that a bare addAll would lose), the faithful throwing dispatcher, and the newLineIfNotEmpty handling in generateServiceRegistry.

The one change vs the pre-rebase branch is a // CPD-OFF … // CPD-ON marker around the createCheckExecution/createCheckCaller toMethod skeleton in CheckJvmModelInferrer — a pre-existing, faithful duplication (both methods emit the same toMethod(ctx, name, typeRef("void"), …) shape, as the original Xtend did) that only surfaces now because the branch rebased onto master's stricter pmd.cpd.min=100. Same treatment and rationale as the migrated ANTLR generators.

Verification

  • Full local gate from ddk-parent: mvn -T 3C clean verify checkstyle:check pmd:check pmd:cpd-check spotbugs:checkBUILD SUCCESS, 358 tests / 0 failures / 0 errors, all static analysis clean.
  • Behavior preserved: the check.core test suite (CheckValidationTest, CheckQuickfixTest, generator/scoping tests) passes; the reconciliation confirmed byte- or behavior-equivalence to the xtend-gen ground truth across all 8 files.

🤖 Generated with Claude Code

joaodinissf and others added 3 commits July 19, 2026 12:28
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>
@joaodinissf
joaodinissf force-pushed the migrate/xtend-to-java/check-core branch from 72b635e to 2fa945b Compare July 19, 2026 11:17
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