Skip to content

Consolidate Behavior Annex validator traversals with EMF switches 馃 - #3245

Merged
lwrage merged 2 commits into
masterfrom
3244_consolidate_ba_validator_traversals
Sep 18, 2026
Merged

lwrage merged 2 commits into
masterfrom
3244_consolidate_ba_validator_traversals

Conversation

@lwrage

@lwrage lwrage commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Fixes #3244.

BehaviorAnnexValidator previously enumerated the declarative annex ten times and the translated strict annex twice. Dispatch through the generated BehaviorAnnexSwitch now collects declarations, detects unresolved references, and queues applicable checks in one source-model traversal. Translation still waits for the existing prerequisites, and every queued check runs before deciding whether to invoke the strict analyzers. AadlBaSwitch combines property-value and property-units checks in one strict-model traversal.

Fast Xtext checks, diagnostic messages/codes/locations, and the existing type, initialization, and legality analyzers retain their behavior. The traversal consolidation applies to the adapter; the translator and semantic analyzers retain their own processing.

Issue3244Test uses an external issue3244 AADL project with an invalid array size, nested for/forall targets, an outgoing-port status value, and a property reference with both missing-value and units errors. It asserts all six diagnostics with their severities and written source spans, while a second valid annex checks isolation. The characterization test passes on the original implementation and after the refactor. The test commit precedes the production commit.

Validation

Characterization against the original validator: 1 test, no failures, errors, or skips.

mvn -o -T5 -s releng/osate.releng/settings.xml -Plocal \
  -pl :org.osate.ba,:org.osate.xtext.aadl2.ba,:org.osate.xtext.aadl2.ba.tests,:org.osate.ba.feature \
  -Dtycho.localArtifacts=default -Dpr.build=true -Dsign=false \
  -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false \
  -Dtest=Issue3244Test -DfailIfNoTests=false clean install

Final clean root reactor: 143 projects and 1,651 tests, with no failures, errors, or skips. This includes 206 BA and BA integration tests; the existing diagnostic goldens remain unchanged.

mvn -o -T5 -s releng/osate.releng/settings.xml -Plocal \
  -Dtycho.localArtifacts=ignore -Dpr.build=true -Dsign=false \
  -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false \
  -DfailIfNoTests=false clean install

git diff --check passes.

Dependencies and residual risk

Targets master; there are no unmerged PR dependencies or merge-order requirements. Queued checks add temporary memory proportional to the applicable checks, and diagnostic emission can follow traversal order rather than the previous grouping by check type. No elapsed-time performance improvement has been measured.

Characterize independent Behavior Annex diagnostics across an invalid array
dimension and nested for/forall actions. Assert the diagnostic codes,
severities, and written source spans, including both checks on one property
reference, while a second valid annex verifies per-annex isolation.

Keep the fixture in its own issue3244 model project. This behavior-preserving
refactor is covered by a test that passes before and after the traversal change.
Use the generated BehaviorAnnexSwitch to collect declarations, detect
unresolved references, and queue node-local checks during one source-model
walk. Execute the queued checks after the existing translation prerequisites
have passed, retaining independent diagnostics and strict-checker gating.

Use AadlBaSwitch to check property values and units together in one strict-model
walk. This reduces the adapter's twelve whole-model traversals to one per
model while preserving fast Xtext checks and the existing semantic analyzers.

Fixes #3244.
@lwrage
lwrage merged commit 652d88e into master Sep 18, 2026
1 check passed
@lwrage
lwrage deleted the 3244_consolidate_ba_validator_traversals branch September 18, 2026 14:23
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.

Avoid repeated model traversals during Behavior Annex validation 馃

2 participants