fix(format): guard against null members in FormatJvmModelInferrer.inferConstants - #1474
Merged
joaodinissf merged 2 commits intoAug 25, 2026
Conversation
Member
|
Can you rebase this commit? |
joaodinissf
force-pushed
the
fix/format-inferconstants-null-leak
branch
from
August 24, 2026 14:17
753cbd5 to
80c81e7
Compare
joaodinissf
marked this pull request as ready for review
August 24, 2026 14:17
Member
|
The maven verify passed, so our baseline check is not working, I will need to investigate, or if you can, please, be my guest :) |
joaodinissf
added a commit
to joaodinissf/dsl-devkit
that referenced
this pull request
Aug 24, 2026
Temporary, dropped from the branch after the run (a git revert cannot restore green: the revert commit itself would move the bundle's jgit qualifier past the baseline again). With the baseline gate revived, this commit's verify run must FAIL with 'Only qualifier changed for (com.avaloq.tools.ddk/...)' - proving the gate that dsldevkit#1474 silently bypassed is now active. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
joaodinissf
added a commit
that referenced
this pull request
Aug 24, 2026
The Actions dependency cache persists Tycho's HTTP cache (~/.m2/repository/.cache/tycho) inside ~/.m2/repository. Tycho's cache-first transport never revalidates cached 404/301 entries and p2/releases/latest + p2/snapshots/latest are moving pointers, so restored blobs served a stale baseline and the compare-version-with-baselines gate passed vacuously (the mojo has no 'baseline not found' branch) - every compare execution completed in 1-22 ms with no network access and no comparisons, and the snapshot baseline validator logged 'No baseline version' for all 64 modules in every run since May. This is how #1474 changed bundle content without a version bump and still passed maven-verify. Delete only the DDK hosts' cached metadata after each cache restore, in verify.yml and snapshot.yml: the baseline is fetched fresh (a few KB) while versioned eclipse.org metadata and all downloaded artifacts stay cached. release.yml runs no Maven build and needs no change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…erConstants inferConstants added createConstant(format, c) to the JVM model unconditionally. createConstant returns null for a value-less constant (its switch fall-through), so a null JvmMember reached it.getMembers().add(...) — which the EMF EList rejects with IllegalArgumentException: The 'no null' constraint is violated (or leaks a null member downstream). Regression class: the original Xtend `members += allConstants.map[createConstant]` compiled to JvmTypesBuilder.operator_add, which silently skips nulls; the Xtend-to-Java migration translated it to a bare loop-add that does not. Guard the add (equivalent to operator_add's null-skip). Add FormatJvmModelInferrerTest pinning the behaviour: a value-less constant must not produce a null member or throw. A/B verified — the test fails on the pre-fix code (no null constraint violated) and passes with the guard. Found by an archaeology audit of the merged Xtend→Java migrations; the skill rule that prevents this class is added separately (rules/10 §10.5). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
joaodinissf
force-pushed
the
fix/format-inferconstants-null-leak
branch
from
August 24, 2026 18:48
80c81e7 to
9a67b51
Compare
The compare-version-with-baselines gate correctly rejected this branch after rebase: the null-guard change alters the bundle's content while its version matched the v19.0.0 baseline (17.3.1). Micro bump per OSGi conventions. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
rubenporras
approved these changes
Aug 25, 2026
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.
The bug
FormatJvmModelInferrer.inferConstantsaddscreateConstant(format, c)to the inferred JVM model unconditionally:createConstantreturnsnullfor a value-less constant (itsif (stringValue) … else if (intValue) … return nullfall-through — reachable for a constant in an incomplete/error state during editing). Adding that null to theJvmMemberEListthrowsIllegalArgumentException: The 'no null' constraint is violated.Root cause — a migration regression
The original Xtend was
members += allConstants.map[createConstant], which compiles toJvmTypesBuilder.operator_add, andoperator_addsilently skips null elements. The Xtend→Java migration translated+=to a bare loop-add, which does not skip nulls — so the null-skip semantics were lost. The siblinginferRulesin the same file kept the null-skip, making this an inconsistent one-off.The fix
Guard the add (equivalent to
operator_add's null-skip / anIterableExtensions.filterNull):Verification
FormatJvmModelInferrerTestpins the behaviour: a value-lessConstantmust not yield a null member or throw.IllegalArgumentException: The 'no null' constraint is violated) and passes with the guard. Full local gate: BUILD SUCCESS, 359 tests / 0 failures, all static analysis clean.Found by an archaeology audit of the merged Xtend→Java migrations. The skill rule that prevents this class of defect is added in a separate PR (#1473,
rules/10 §10.5—operator_addskips nulls).🤖 Generated with Claude Code