Skip to content

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

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

refactor: migrate Xtend to Java - com.avaloq.tools.ddk.check.core#1452
joaodinissf wants to merge 4 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: pure git mv rename → in-place translate → infrastructure cleanup → separate style pass (Java 21 pattern matching in the hand-written dispatchers, kept out of the faithful translation commit for clean revertability).

How it was validated

Two independent lines of evidence, both against the authoritative ground truth — a freshly built xtend-gen/ (what the Xtend compiler itself produced from these sources, built off current master):

  • Blind re-migration + three-way reconciliation: a second migration was produced independently from the .xtend sources without sight of this branch, then reconciled file-by-file against this branch with xtend-gen as arbiter. The two migrations converged on identical semantics at every contested site (dispatcher contracts, filterNull null-skip preservation, issue-code sort order, template whitespace, sentinel returns).
  • Adversarial per-file verification: each file was line-verified against xtend-gen (every one-arg vs two-arg append, newLineIfNotEmpty occurrence, null-handling quirk, iteration order, and exception surface), with each candidate finding subjected to a refutation pass. Two real defects were found and fixed on this branch: fabricated Javadoc in the generator files (now restored to the originals' exact comment state) and a malformed .classpath from the infra cleanup (now xmllint-valid).

Deliberate, output-neutral divergences from xtend-gen, kept and documented: explicit UTF-8 in getContents (PMD RelianceOnDefaultCharset), checked-exception wrapping in IllegalStateException, and the CPD-OFF marker around the faithful toMethod duplication in CheckJvmModelInferrer (master's stricter pmd.cpd.min=100).

Verification

Full local gate from ddk-parent (verify checkstyle:check pmd:check spotbugs:check, check.core + test bundle + upstream deps): BUILD SUCCESS, test suite green, all static analysis clean. CI green on the pushed stack.

🤖 Generated with Claude Code

@joaodinissf
joaodinissf force-pushed the migrate/xtend-to-java/check-core branch 2 times, most recently from 0f48915 to 72b635e Compare July 6, 2026 11:37
@joaodinissf
joaodinissf force-pushed the migrate/xtend-to-java/check-core branch from 72b635e to 2fa945b Compare July 19, 2026 11:17
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>
@joaodinissf
joaodinissf force-pushed the migrate/xtend-to-java/check-core branch from 2fa945b to f43aba0 Compare August 2, 2026 05:36
joaodinissf and others added 3 commits August 2, 2026 07:51
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).
- Comments preserve the originals' exact state: block comments stay
  block comments, and no Javadoc is invented (checkstyle only validates
  Javadoc that exists; it does not require any).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <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:
org.eclipse.xtext.xbase.lib stays as a direct dependency because the
migrated sources still use IterableExtensions/ListExtensions/
StringExtensions and StringConcatenation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Post-verification style pass, kept separate from the faithful translation
commit for clean revertability:
- adopt Java 21 pattern matching in the hand-written dispatchers
  (CheckTypeComputer, CheckScopeProvider, CheckGeneratorExtensions,
  CheckFormatter — 62 branches)
- CheckFormatter: rename the generic dispatcher parameter xlistliteral to
  element, collapse the tail's impossible final else (provably unreachable:
  requires x == null and x != null both false), drop the dead Arrays import,
  restore final on loop variables
- CheckGenerator: fix misspelled local formattedCateogryDescription
- CheckGeneratorExtensions: build the splitCamelCase regex from named
  compile-time String constants folded by the compiler instead of a runtime
  .formatted() call

Behavior is identical by construction; verified against the fresh xtend-gen
ground truth as part of the migration verification.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joaodinissf
joaodinissf force-pushed the migrate/xtend-to-java/check-core branch from f43aba0 to 74444ba Compare August 2, 2026 05:52
@joaodinissf
joaodinissf marked this pull request as ready for review August 2, 2026 05:52
@joaodinissf
joaodinissf requested a review from rubenporras August 2, 2026 05:52
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