refactor: migrate Xtend to Java - com.avaloq.tools.ddk.check.core.test#1427
Open
joaodinissf wants to merge 3 commits into
Open
refactor: migrate Xtend to Java - com.avaloq.tools.ddk.check.core.test#1427joaodinissf wants to merge 3 commits into
joaodinissf wants to merge 3 commits into
Conversation
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>
rubenporras
requested changes
Jun 18, 2026
|
|
||
| /* Returns a base model stub with a default category. */ | ||
| public String modelWithCategory() { | ||
| return modelWithGrammar() + "category \"Default Category\" {"; |
Member
There was a problem hiding this comment.
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); |
Member
There was a problem hiding this comment.
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(); |
Member
There was a problem hiding this comment.
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); |
Member
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was migrated
All eight Xtend test sources in
com.avaloq.tools.ddk.check.core.testwere translated to Java:check/core/generator/IssueCodeValueTestcheck/core/test/BasicModelTestcheck/core/test/BugAig830check/core/test/CheckScopingTestcheck/core/test/IssueCodeToLabelMapGenerationTestcheck/core/test/ProjectBasedTestscheck/core/test/util/CheckModelUtilcheck/core/test/util/CheckTestUtilcheck/formatting/CheckFormattingTestcheck/validation/CheckApiAccessValidationsTestcheck/validation/CheckValidationTestThe translations are mechanical, preserving the existing test behaviour.
Per-module Xtend infrastructure removed
The
xtend-gensource folder (and its.gitignore) was dropped, and.classpath,.project,MANIFEST.MF, andbuild.propertieswere updated to remove the Xtend nature, builder, and generated-source wiring.Validation
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.