|
| 1 | +# Xtend → Java migration roadmap |
| 2 | + |
| 3 | +Living document. Lives on `feature/xtend-to-java-migration`. Updated each week as slices are cut and merged. |
| 4 | + |
| 5 | +## Scope |
| 6 | + |
| 7 | +94 `.xtend` files → 87 `.java` files on this branch, with 2122 supporting edits (POMs, MANIFEST.MFs, feature.xmls, `.project`, `.classpath`). The migration is complete on this branch; the remaining work is **merging it into master in reviewable slices**, one per week, with each slice manually vetted against the Java best-practices checklist below. |
| 8 | + |
| 9 | +## Process for each weekly slice |
| 10 | + |
| 11 | +1. **Cut a fresh branch from master**, not from this branch: |
| 12 | + ```bash |
| 13 | + SLICE=migrate/xtend-to-java/<slice-name> |
| 14 | + git fetch origin |
| 15 | + git checkout -b "$SLICE" origin/master |
| 16 | + ``` |
| 17 | +2. **Grab just this slice's files from the migration branch**: |
| 18 | + ```bash |
| 19 | + git checkout feature/xtend-to-java-migration -- <path1> <path2> ... |
| 20 | + ``` |
| 21 | +3. **Manually vet each file** against the review checklist below. Do not trust that the migration branch is already clean — the goal of the slice review is to catch any residual issues. |
| 22 | +4. **Build and test the affected plugins**: |
| 23 | + ```bash |
| 24 | + mvn -pl <module1>,<module2> -am verify -f ./ddk-parent/pom.xml |
| 25 | + ``` |
| 26 | + Then run the full CI-equivalent check before pushing: |
| 27 | + ```bash |
| 28 | + xvfb-run mvn clean verify checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check spotbugs:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end |
| 29 | + ``` |
| 30 | +5. **Commit, push, open PR** against master. |
| 31 | +6. **Once merged**, update the status column in this file. |
| 32 | + |
| 33 | +## Review checklist (applied to every slice) |
| 34 | + |
| 35 | +For each migrated `.java` file, verify: |
| 36 | + |
| 37 | +- [ ] **No `val`** — Xtend's `val` must not leak via pretend-typed variables. Use an explicit type or `var`; prefer explicit type for fields, method returns, and any variable where the type is not obvious from the RHS. |
| 38 | +- [ ] **String handling is idiomatic**: |
| 39 | + - simple `+` concatenation for a single dynamic insertion, |
| 40 | + - `String.format` for multi-value templates, |
| 41 | + - text blocks for multi-line strings, |
| 42 | + - `StringBuilder` only when building in a loop or branch, |
| 43 | + - never `String.valueOf(x) + "..."` when `x + "..."` works. |
| 44 | +- [ ] **Preserved stack traces in catch blocks** (PMD `PreserveStackTrace`): every `throw new WrapperException(...)` in a catch must pass the caught exception as cause. |
| 45 | +- [ ] **Parameterized SLF4J logging**: `logger.info("x={}", x)` — never `logger.info("x=" + x)`, never `logger.info(String.format(...))`. |
| 46 | +- [ ] **try-with-resources** for every `AutoCloseable` (streams, scanners, writers, JDBC). |
| 47 | +- [ ] **No unnecessary boxing** — `Integer.valueOf(i)` only when the method signature demands it. |
| 48 | +- [ ] **`@Override` on every override**, including interface methods. |
| 49 | +- [ ] **No wildcard imports**. |
| 50 | +- [ ] **PMD, Checkstyle, SpotBugs clean** — the slice must pass `verify.yml`'s full command without `--fail-at-end` tolerating anything. |
| 51 | +- [ ] **Behavior preserved** — sanity-diff the Xtend source against the Java output for any non-mechanical transformation (lambda captures, operator overloading → method calls, extension methods, elvis `?:`, safe-nav `?.`, list/map literal syntax). |
| 52 | +- [ ] **Each plugin still builds standalone**, and each plugin's tests still pass on their own. |
| 53 | + |
| 54 | +## Slice order |
| 55 | + |
| 56 | +Ordered leaves → trunk so that rollback of a single slice doesn't cascade. DSL families move as one unit (core + ide + ui + test + generator) so that each slice is independently shippable. |
| 57 | + |
| 58 | +| # | Week | Slice | Modules | Xtend files | Risk | Status | |
| 59 | +|---|------|-------|---------|-------------|------|--------| |
| 60 | +| 1 | TBD | Warmup — samples & leaf tests | `sample.helloworld.ui.test`, `check.ui.test`, `xtext.ui.test`, `xtext.generator.test` | 6 | Low | Not started | |
| 61 | +| 2 | TBD | `xtext.format` DSL family | `xtext.format`, `.format.ide`, `.format.test`, `.format.ui`, `.format.generator` | 11 | Low | Not started | |
| 62 | +| 3 | TBD | `xtext.scope` DSL family | `xtext.scope`, `.scope.generator` | 5 | Low | Not started | |
| 63 | +| 4 | TBD | `xtext.expression` DSL | `xtext.expression` | 5 | Low | Not started | |
| 64 | +| 5 | TBD | `xtext.export` DSL family | `xtext.export`, `.export.generator` | 10 | Medium | Not started | |
| 65 | +| 6 | TBD | `checkcfg` DSL + tests | `checkcfg.core`, `checkcfg.core.test` | 11 | Medium | Not started | |
| 66 | +| 7 | TBD | `check.core` (production DSL) | `check.core` | 8 | **High** — production check framework | Not started | |
| 67 | +| 8 | TBD | Check tests & runtime | `check.core.test`, `check.test.runtime`, `check.test.runtime.tests` | 15 | Low (tests only) | Not started | |
| 68 | +| 9 | TBD | Xtext test utilities + UI helpers | `xtext.test.core`, `xtext.ui`, `xtext.check.generator` | 5 | Medium | Not started | |
| 69 | +| 10 | TBD | `xtext.generator` — parser group | `xtext.generator` (Antlr / annotation-aware fragments + `BundleVersionStripperFragment`, `DefaultFragmentWithOverride`) | 8 | Medium (build-time only) | Not started | |
| 70 | +| 11 | TBD | `xtext.generator` — builder + misc | `xtext.generator` (builder/LSP fragments, formatter, language constants, model inference, project config, resource factory, compare, content-assist) | 10 | Medium (build-time only) | Not started | |
| 71 | +| 12 | TBD | Cleanup — remove Xtend build infrastructure | POMs (`xtend-maven-plugin`), MANIFEST.MFs (`org.eclipse.xtend` imports), `feature.xml` (xtend bundles), `.classpath` / `.project` (Xtend nature), `xtend-gen/` directories, PMD config references | 0 (infrastructure only) | Low — final confirmation that nothing imports Xtend anymore | Not started | |
| 72 | + |
| 73 | +If a week is particularly quiet or a slice is particularly small, adjacent small slices (e.g., #3 + #4) can combine. Don't combine across risk tiers. |
| 74 | + |
| 75 | +## File inventory per slice |
| 76 | + |
| 77 | +<details> |
| 78 | +<summary>Slice 1 — Warmup — samples & leaf tests (6 files)</summary> |
| 79 | + |
| 80 | +- `com.avaloq.tools.ddk.sample.helloworld.ui.test/src/.../CheckConfigurationIsAppliedTest.xtend` |
| 81 | +- `com.avaloq.tools.ddk.sample.helloworld.ui.test/src/.../CheckExecutionEnvironmentProjectTest.xtend` |
| 82 | +- `com.avaloq.tools.ddk.sample.helloworld.ui.test/src/.../IssueLabelTest.xtend` |
| 83 | +- `com.avaloq.tools.ddk.check.ui.test/src/.../CheckQuickfixTest.xtend` |
| 84 | +- `com.avaloq.tools.ddk.xtext.ui.test/src/.../TemplateProposalProviderHelperTest.xtend` |
| 85 | +- `com.avaloq.tools.ddk.xtext.generator.test/src/.../XbaseGeneratorFragmentTest.xtend` |
| 86 | +</details> |
| 87 | + |
| 88 | +<details> |
| 89 | +<summary>Slice 2 — xtext.format DSL family (11 files)</summary> |
| 90 | + |
| 91 | +- `xtext.format/src/.../FormatRuntimeModule.xtend` |
| 92 | +- `xtext.format/src/.../FormatStandaloneSetup.xtend` |
| 93 | +- `xtext.format/src/.../generator/FormatGenerator.xtend` |
| 94 | +- `xtext.format/src/.../jvmmodel/FormatJvmModelInferrer.xtend` |
| 95 | +- `xtext.format/src/.../scoping/FormatScopeProvider.xtend` |
| 96 | +- `xtext.format/src/.../validation/FormatValidator.xtend` |
| 97 | +- `xtext.format.ide/src/.../FormatIdeModule.xtend` |
| 98 | +- `xtext.format.ide/src/.../FormatIdeSetup.xtend` |
| 99 | +- `xtext.format.test/src/.../FormatParsingTest.xtend` |
| 100 | +- `xtext.format.ui/src/.../FormatUiModule.xtend` |
| 101 | +- `xtext.format.generator/src/.../FormatFragment2.xtend` |
| 102 | +</details> |
| 103 | + |
| 104 | +<details> |
| 105 | +<summary>Slice 3 — xtext.scope DSL family (5 files)</summary> |
| 106 | + |
| 107 | +- `xtext.scope/src/.../generator/ScopeGenerator.xtend` |
| 108 | +- `xtext.scope/src/.../generator/ScopeNameProviderGenerator.xtend` |
| 109 | +- `xtext.scope/src/.../generator/ScopeProviderGenerator.xtend` |
| 110 | +- `xtext.scope/src/.../generator/ScopeProviderX.xtend` |
| 111 | +- `xtext.scope.generator/src/.../ScopingFragment2.xtend` |
| 112 | +</details> |
| 113 | + |
| 114 | +<details> |
| 115 | +<summary>Slice 4 — xtext.expression DSL (5 files)</summary> |
| 116 | + |
| 117 | +- `xtext.expression/src/.../generator/CodeGenerationX.xtend` |
| 118 | +- `xtext.expression/src/.../generator/ExpressionExtensionsX.xtend` |
| 119 | +- `xtext.expression/src/.../generator/GeneratorUtilX.xtend` |
| 120 | +- `xtext.expression/src/.../generator/GenModelUtilX.xtend` |
| 121 | +- `xtext.expression/src/.../generator/Naming.xtend` |
| 122 | +</details> |
| 123 | + |
| 124 | +<details> |
| 125 | +<summary>Slice 5 — xtext.export DSL family (10 files)</summary> |
| 126 | + |
| 127 | +- `xtext.export/src/.../generator/ExportedNamesProviderGenerator.xtend` |
| 128 | +- `xtext.export/src/.../generator/ExportFeatureExtensionGenerator.xtend` |
| 129 | +- `xtext.export/src/.../generator/ExportGenerator.xtend` |
| 130 | +- `xtext.export/src/.../generator/ExportGeneratorX.xtend` |
| 131 | +- `xtext.export/src/.../generator/FingerprintComputerGenerator.xtend` |
| 132 | +- `xtext.export/src/.../generator/FragmentProviderGenerator.xtend` |
| 133 | +- `xtext.export/src/.../generator/ResourceDescriptionConstantsGenerator.xtend` |
| 134 | +- `xtext.export/src/.../generator/ResourceDescriptionManagerGenerator.xtend` |
| 135 | +- `xtext.export/src/.../generator/ResourceDescriptionStrategyGenerator.xtend` |
| 136 | +- `xtext.export.generator/src/.../ExportFragment2.xtend` |
| 137 | +</details> |
| 138 | + |
| 139 | +<details> |
| 140 | +<summary>Slice 6 — checkcfg DSL + tests (11 files)</summary> |
| 141 | + |
| 142 | +- `checkcfg.core/src/.../generator/CheckCfgGenerator.xtend` |
| 143 | +- `checkcfg.core/src/.../jvmmodel/CheckCfgJvmModelInferrer.xtend` |
| 144 | +- `checkcfg.core/src/.../util/PropertiesInferenceHelper.xtend` |
| 145 | +- `checkcfg.core/src/.../validation/ConfiguredParameterChecks.xtend` |
| 146 | +- `checkcfg.core.test/src/.../contentassist/CheckCfgContentAssistTest.xtend` |
| 147 | +- `checkcfg.core.test/src/.../scoping/CheckCfgScopeProviderTest.xtend` |
| 148 | +- `checkcfg.core.test/src/.../syntax/CheckCfgSyntaxTest.xtend` |
| 149 | +- `checkcfg.core.test/src/.../util/CheckCfgModelUtil.xtend` |
| 150 | +- `checkcfg.core.test/src/.../util/CheckCfgTestUtil.xtend` |
| 151 | +- `checkcfg.core.test/src/.../validation/CheckCfgConfiguredParameterValidationsTest.xtend` |
| 152 | +- `checkcfg.core.test/src/.../validation/CheckCfgTest.xtend` |
| 153 | +</details> |
| 154 | + |
| 155 | +<details> |
| 156 | +<summary>Slice 7 — check.core production DSL (8 files)</summary> |
| 157 | + |
| 158 | +- `check.core/src/.../compiler/CheckGeneratorConfig.xtend` |
| 159 | +- `check.core/src/.../formatting2/CheckFormatter.xtend` |
| 160 | +- `check.core/src/.../generator/CheckGenerator.xtend` |
| 161 | +- `check.core/src/.../generator/CheckGeneratorExtensions.xtend` |
| 162 | +- `check.core/src/.../generator/CheckGeneratorNaming.xtend` |
| 163 | +- `check.core/src/.../jvmmodel/CheckJvmModelInferrer.xtend` |
| 164 | +- `check.core/src/.../scoping/CheckScopeProvider.xtend` |
| 165 | +- `check.core/src/.../typing/CheckTypeComputer.xtend` |
| 166 | + |
| 167 | +**Review extra-carefully:** this is the runtime Check framework used by downstream consumers. Diff every file against its Xtend original line-by-line, not just for style. |
| 168 | +</details> |
| 169 | + |
| 170 | +<details> |
| 171 | +<summary>Slice 8 — Check tests & runtime (15 files)</summary> |
| 172 | + |
| 173 | +- `check.core.test/src/.../generator/IssueCodeValueTest.xtend` |
| 174 | +- `check.core.test/src/.../test/BasicModelTest.xtend` |
| 175 | +- `check.core.test/src/.../test/BugAig830.xtend` |
| 176 | +- `check.core.test/src/.../test/CheckScopingTest.xtend` |
| 177 | +- `check.core.test/src/.../test/IssueCodeToLabelMapGenerationTest.xtend` |
| 178 | +- `check.core.test/src/.../test/ProjectBasedTests.xtend` |
| 179 | +- `check.core.test/src/.../test/util/CheckModelUtil.xtend` |
| 180 | +- `check.core.test/src/.../test/util/CheckTestUtil.xtend` |
| 181 | +- `check.core.test/src/.../formatting/CheckFormattingTest.xtend` |
| 182 | +- `check.core.test/src/.../validation/CheckApiAccessValidationsTest.xtend` |
| 183 | +- `check.core.test/src/.../validation/CheckValidationTest.xtend` |
| 184 | +- `check.test.runtime/src/.../generator/TestLanguageGenerator.xtend` |
| 185 | +- `check.test.runtime.tests/src/.../CheckConfigurationIsAppliedTest.xtend` |
| 186 | +- `check.test.runtime.tests/src/.../CheckExecutionEnvironmentProjectTest.xtend` |
| 187 | +- `check.test.runtime.tests/src/.../label/IssueLabelTest.xtend` |
| 188 | +</details> |
| 189 | + |
| 190 | +<details> |
| 191 | +<summary>Slice 9 — Xtext test utilities + UI helpers (5 files)</summary> |
| 192 | + |
| 193 | +- `xtext.test.core/src/.../resource/AbstractResourceDescriptionManagerTest.xtend` |
| 194 | +- `xtext.test.core/src/.../Tag.xtend` |
| 195 | +- `xtext.ui/src/.../templates/TemplateProposalProviderHelper.xtend` |
| 196 | +- `xtext.check.generator/src/.../CheckValidatorFragment2.xtend` |
| 197 | +- `xtext.check.generator/src/.../quickfix/CheckQuickfixProviderFragment2.xtend` |
| 198 | +</details> |
| 199 | + |
| 200 | +<details> |
| 201 | +<summary>Slice 10 — xtext.generator parser group (8 files)</summary> |
| 202 | + |
| 203 | +- `xtext.generator/src/.../parser/antlr/AbstractAnnotationAwareAntlrGrammarGenerator.xtend` |
| 204 | +- `xtext.generator/src/.../parser/antlr/AnnotationAwareAntlrContentAssistGrammarGenerator.xtend` |
| 205 | +- `xtext.generator/src/.../parser/antlr/AnnotationAwareAntlrGrammarGenerator.xtend` |
| 206 | +- `xtext.generator/src/.../parser/antlr/AnnotationAwareXtextAntlrGeneratorFragment2.xtend` |
| 207 | +- `xtext.generator/src/.../parser/common/GrammarRuleAnnotations.xtend` |
| 208 | +- `xtext.generator/src/.../parser/common/PredicatesNaming.xtend` |
| 209 | +- `xtext.generator/src/.../BundleVersionStripperFragment.xtend` |
| 210 | +- `xtext.generator/src/.../DefaultFragmentWithOverride.xtend` |
| 211 | +</details> |
| 212 | + |
| 213 | +<details> |
| 214 | +<summary>Slice 11 — xtext.generator builder & misc (10 files)</summary> |
| 215 | + |
| 216 | +- `xtext.generator/src/.../builder/BuilderIntegrationFragment2.xtend` |
| 217 | +- `xtext.generator/src/.../builder/LspBuilderIntegrationFragment2.xtend` |
| 218 | +- `xtext.generator/src/.../builder/StandaloneBuilderIntegrationFragment2.xtend` |
| 219 | +- `xtext.generator/src/.../formatting/FormatterFragment2.xtend` |
| 220 | +- `xtext.generator/src/.../languageconstants/LanguageConstantsFragment2.xtend` |
| 221 | +- `xtext.generator/src/.../modelinference/ModelInferenceFragment2.xtend` |
| 222 | +- `xtext.generator/src/.../model/project/ProjectConfig.xtend` |
| 223 | +- `xtext.generator/src/.../resourceFactory/ResourceFactoryFragment2.xtend` |
| 224 | +- `xtext.generator/src/.../ui/compare/CompareFragment2.xtend` |
| 225 | +- `xtext.generator/src/.../ui/contentAssist/AnnotationAwareContentAssistFragment2.xtend` |
| 226 | +</details> |
| 227 | + |
| 228 | +<details> |
| 229 | +<summary>Slice 12 — Cleanup (infrastructure only, 0 xtend files)</summary> |
| 230 | + |
| 231 | +This slice removes every remaining trace of Xtend tooling now that no `.xtend` sources exist: |
| 232 | + |
| 233 | +- `ddk-parent/pom.xml` — remove `xtend-maven-plugin`, `xtend-gen` source directory config, Xtend dependency versions |
| 234 | +- Per-plugin `pom.xml` — remove any residual Xtend plugin blocks |
| 235 | +- Per-plugin `MANIFEST.MF` — remove `Import-Package: org.eclipse.xtend.*` / `org.eclipse.xtext.xbase.lib` entries that are no longer used |
| 236 | +- Per-plugin `.classpath` — remove `xtend-gen` source folder entries |
| 237 | +- Per-plugin `.project` — remove Xtend nature, Xtend incremental project builder |
| 238 | +- `releng/**/feature.xml` — remove `org.eclipse.xtend.lib` and related bundles from the product features |
| 239 | +- Delete every `xtend-gen/` directory |
| 240 | +- `ddk-configuration/pmd/ruleset.xml` — remove `.*/xtend-gen/.*` exclude pattern (line 11 today) |
| 241 | +- `ddk-configuration/checkstyle/**` — same cleanup if any xtend-gen exclusions exist |
| 242 | +- Verify no remaining reference to `org.eclipse.xtend` or `xtend-gen` in the tree: |
| 243 | + ```bash |
| 244 | + rg -t xml -t java -t properties 'org\.eclipse\.xtend|xtend-gen' |
| 245 | + ``` |
| 246 | +</details> |
| 247 | + |
| 248 | +## Known pitfalls from the migration work |
| 249 | + |
| 250 | +Documented here so each reviewer doesn't have to rediscover them: |
| 251 | + |
| 252 | +- **`CoreException` handling** — Xtend silently wraps checked exceptions; Java doesn't. Several files needed explicit `try`/`catch` added (see commit `a5deb4e3c`). |
| 253 | +- **PMD `UseCollectionIsEmpty`** — Xtend's `.isEmpty` translates to `.isEmpty()` but chained differently in a few places. Watch for `.size() == 0` patterns that should be `.isEmpty()`. |
| 254 | +- **PMD `UnnecessaryBoxing`** — Xtend auto-boxes aggressively. The converter sometimes leaves `Integer.valueOf(i)` where a primitive works. |
| 255 | +- **PMD `StringToString`**, **`UnnecessaryCast`**, **`MissingOverride`**, **`LooseCoupling`** — all hit during migration cleanup. Make sure any new violations get caught in slice review, not after merge. |
| 256 | +- **`BasicEList` compilation errors in test code** — `XbaseGeneratorFragmentTest` needed a type-parameter fix (commit `3517ba896`). Test code that does generic-heavy collection building needs extra attention. |
| 257 | +- **Text blocks vs. `StringBuilder`** — the later commits in this branch converted `StringBuilder`-heavy generators to text blocks / `String.format` (`da8c8d91b`, `71afbe9db`, `a5cb80dec`). Make sure any `StringBuilder` that survives is actually necessary (loop/branch). |
| 258 | +- **`val` leaks** — Xtend's `val` always converts to `final Type`, but the converter sometimes uses a pseudo-general type. Enforce explicit types or `var`. |
| 259 | +- **Non-parameterized SLF4J logging** — mostly cleaned up project-wide, but migration-era Xtend files had `logger.info("msg" + x)` patterns that should now be `logger.info("msg {}", x)`. |
| 260 | + |
| 261 | +## Rollback plan |
| 262 | + |
| 263 | +If a merged slice turns out to break a downstream consumer, revert the slice's merge commit (`git revert -m 1 <merge-sha>`) and reopen the slice branch for rework. Do **not** revert files individually — each slice is one coherent unit by module. |
| 264 | + |
| 265 | +## Branch hygiene |
| 266 | + |
| 267 | +- This file lives on `feature/xtend-to-java-migration`; update the **status** column on master-merge days by pushing a commit here. |
| 268 | +- The slice branches themselves (`migrate/xtend-to-java/<name>`) can be deleted after merge. |
| 269 | +- Once slice 12 ships, this branch itself is redundant — keep it around until the roadmap says all slices are ✅ merged, then delete. |
0 commit comments