Skip to content

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

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

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

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

What was migrated

All eight Xtend test sources in com.avaloq.tools.ddk.check.core.test were translated to Java:

  • check/core/generator/IssueCodeValueTest
  • check/core/test/BasicModelTest
  • check/core/test/BugAig830
  • check/core/test/CheckScopingTest
  • check/core/test/IssueCodeToLabelMapGenerationTest
  • check/core/test/ProjectBasedTests
  • check/core/test/util/CheckModelUtil
  • check/core/test/util/CheckTestUtil
  • check/formatting/CheckFormattingTest
  • check/validation/CheckApiAccessValidationsTest
  • check/validation/CheckValidationTest

The translations are mechanical, preserving the existing test behaviour.

Per-module Xtend infrastructure removed

The xtend-gen source folder (and its .gitignore) was dropped, and .classpath, .project, MANIFEST.MF, and build.properties were updated to remove the Xtend nature, builder, and generated-source wiring.

Validation

  • Build: green.
  • Local gate (checkstyle / PMD / SpotBugs): green.

Self-review verdict: CONCERNS

The automated verify pass flagged concerns on this migration. These should be looked at during morning review before this PR is taken out of draft.

joaodinissf and others added 2 commits June 17, 2026 00:18
Migrated all eight Xtend test sources in com.avaloq.tools.ddk.check.core.test to Java: IssueCodeValueTest, BasicModelTest, BugAig830, CheckScopingTest, IssueCodeToLabelMapGenerationTest, ProjectBasedTests, util/CheckModelUtil, util/CheckTestUtil, CheckFormattingTest, CheckApiAccessValidationsTest, and CheckValidationTest. Per-module Xtend infrastructure was removed: the xtend-gen source folder (and its .gitignore) was dropped and the .classpath, .project, MANIFEST.MF, and build.properties were updated to remove the Xtend nature, builder, and generated-source wiring. Behaviour is preserved; the changes are mechanical Xtend-to-Java translations of the existing test logic.
…attingTest

Replace the 5 StringConcatenation builders (input/expected formatted-Check sources) with Java text blocks. Each was proven byte-identical to the original StringConcatenation output via a comparator before applying, so the formatter assertions are unchanged. Drops the org.eclipse.xtend2.lib.StringConcatenation dependency from this test (file shrinks ~1018->570 lines). Addresses Ruben's review preference (cf. dsldevkit#1426). CheckModelUtil's StringBuilder is a genuine for-loop over a List and is correctly left as idiomatic java.lang.StringBuilder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@joaodinissf joaodinissf marked this pull request as ready for review June 17, 2026 16:01
@joaodinissf joaodinissf requested a review from rubenporras June 17, 2026 16:01

/* Returns a base model stub with a default category. */
public String modelWithCategory() {
return modelWithGrammar() + "category \"Default Category\" {";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use multi line string to avoid quoting \"

/* Returns a base model stub with a severity range. */
public String modelWithSeverityRange(final String min, final String max, final String severity) {
return modelWithCategory()
+ "@SeverityRange(%s .. %s)\n %s ID \"My Check\" ()\n message \"My Message\"".formatted(min, max, severity);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use multi line string to avoid \n


/* Returns a base model stub with a severity range and a default check. */
public String modelWithSeverityRange(final String min, final String max) {
return modelWithCategory() + "@SeverityRange(%s .. %s)\n".formatted(min, max) + modelWithCheck();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use use multi line string to avoid \n and +, something like
"""
@SeverityRange(%s .. %s)
%s
""".formatted(min, max, modelWithCheck())

did Claude forget how to write readable code :)?


/* Returns a base model stub with a check of given ID. */
public String modelWithCheck(final String id) {
return modelWithCategory() + "error %s \"Some Error\" ()\nmessage \"My Message\" {".formatted(id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, I did not continue from here, maybe ask Claude to rewrite with my comments in mind and I look at it again?

Address review feedback (dsldevkit#1427): the model-stub builders used escaped quotes,
embedded \n and + concatenation. Convert the static and single-statement
interpolated builders to Java text blocks with .formatted(), which reads far
better. modelWithContexts stays a StringBuilder (real loop over a List).

Kept as a separate commit on top of the migration so the audited-faithful
conversion remains an isolated checkpoint. Output proven byte-identical to the
prior code for every converted method.

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.

2 participants