Require an integer value constant for a behavior array size and keep it unevaluated 🤖 - #3213
Merged
Conversation
lwrage
added this pull request to stack #3215
September 11, 2026 14:50
lwrage
force-pushed
the
3208_reject_nonconstant_array_size
branch
from
September 11, 2026 16:35
8765cbc to
3b8c5f3
Compare
Model a behavior variable used as another variable's array extent alongside valid literal and property-constant controls. Assert that validation reports exactly one error on the offending size; the test currently fails because the annex is accepted without diagnostics.
Validate behavior-variable array dimensions before invoking the strict-model checkers. Report an ordinary reference expression on the written size while preserving the literal and property-reference forms admitted by the standard.
Model bare and element-prefixed property definitions as behavior-variable array extents alongside valid literal and property-constant controls. Assert that both unrepresentable property references are rejected on their written sizes.
Require a Behavior Annex array-size property reference to translate directly to a property constant. Report bare and element-prefixed property definitions on the written size before strict checking so they cannot silently become zero extents, and update the G12 conformance status.
Separate the ownerless property definition from the element-prefixed reference. Require input#Queue_Size to validate and translate its single non-modal value to extent 8, while retaining one source-local error for a bare property definition with no unambiguous value owner.
Evaluate an element-prefixed array-size property when its referenced owner supplies one non-modal integer value, and store that value as the strict extent. Track representable dimensions so validation rejects only property references whose value is absent, modal, non-integer, or ownerless instead of rejecting all property definitions.
Record the accepted prefixed-property model without BA diagnostics and add separate projections for the rejected bare property definition. The new validated diagnostic pins the ownerless property reference at its source range.
AS5506/3 Rev A D.3 writes a behavior variable array size as an integer value constant, which D.7 spells as an integer literal or a property reference. An aadl2::ArraySize can carry only a literal extent or a property constant, so a property reference has nowhere to go and cannot be kept as written. Add BehaviorArraySize, a subclass of aadl2::ArraySize that owns the size as a BA IntegerValue, the way BehaviorTime owns the value of a behavior time. Subclassing keeps a behavior variable an ArrayableElement, so every consumer that reads a core array dimension keeps working, and the owned containment reference gives the integer value a real owner instead of hanging it off the non-containment sizeProperty. Generated with the EMF model and edit generators. BehaviorArraySizeImpl implements getAadlBaLocationReference by hand, as every BA class whose implementation extends an aadl2 implementation does. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Translation evaluated an element-prefixed array-size property reference against the declarative model and stored the number it read. That reads a per-instance value at declarative translation time, and declarative property lookup answers it with only the element's own associations, the single-element contained associations of its immediate containing classifier, and the property default. A contained association with a longer path, or one declared further up, is invisible to it and belongs to the instance model, so the extent was either rejected as unavailable or frozen at a value the instance model contradicts. Build the size as a BehaviorArraySize and store the declared integer value through toIntegerValue, the way every other integer value position keeps what was written. A property reference now keeps its own form, prefix, indexes, and fields included. The inherited extent is still set for the two forms core AADL can express, an integer literal and an unindexed property constant, so consumers that read a core array dimension see those. Drop propertyArraySize and the representable-array-size tracking with it. Validation keeps the D.3 legality rule that an array size is an integer literal or a property reference, and no longer asks whether the declarative model can supply a value: that question is not about the legality of the declaration. The new ContainedProperty model puts the extent in a contained property association two path elements away, which the old code answered with the property default of 1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
org.osate.utils.internal.PropertyUtils carried a set of property value readers that nothing in the reactor calls, and the array-size translation that read a property value no longer exists. Remove the twenty-two unused public readers, the private getUnit helper that only setFloatValue used, and the imports that went with them. The eight methods the Behavior Annex does use stay: findPropertyAssociation, isInAppliesTo, the two-argument getIntValue, getEnumValue, findPropertyExpression, getPropertyExpression, getValue, and getContainingProperty. org.osate.utils.internal is an exported package, so this removes API. org.osate.utils needs a major version bump and both requiring bundles need their ranges widened accordingly; that belongs to the version-management tooling and is not done here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
lwrage
force-pushed
the
3208_reject_nonconstant_array_size
branch
from
September 11, 2026 16:52
3b8c5f3 to
4ec8f7b
Compare
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.
Fixes #3208
Fixes #3210
This branch carries both defects, since they are the same declaration read two ways: what the grammar accepts as an array size, and what translation does with the size it accepted.
Cause and correction
#3208 — AS5506/3 Rev A D.3 writes a behavior variable array size as the D.7 integer value constant. The shared integer-value grammar also accepts an ordinary reference expression, which names a value variable rather than a constant, and no strict checker constrains an array size.
BehaviorAnnexValidator.checkArraySizesnow reports a reference expression with no property tail, so the illegal form is rejected rather than silently turned into a zero extent.#3210 —
aadl2::ArraySizecarries either a literal extent or a property constant, so a property reference had nowhere to go. Translation compensated by evaluating an element-prefixed reference against the declarative model and storing the number it read. That answers a per-instance question at declarative translation time, and declarative property lookup sees only the element's own associations, the single-element contained associations of its immediate containing classifier, and the property default (NamedElementImpl.getPropertyValueInternal→PropertyAcc.addLocalContained). A contained association with a longer path, or one declared further up, is invisible to it and belongs to the instance model, so the extent was either rejected as unavailable or frozen at a value the instance model contradicts.The correction adds
BehaviorArraySizeto the strict Behavior Annex metamodel, a subclass ofaadl2::ArraySizethat owns the size as a BAIntegerValuethe wayBehaviorTimeowns the value of a behavior time. Translation now routes the declared size through the sametoIntegerValueevery other integer value position uses, so a property reference keeps its own form, prefix, indexes, and fields included. Subclassing rather than replacing the dimension keeps a behavior variable anArrayableElement, soAadlBaUtilsandAadlUtil.getElementCountkeep working, and the inherited extent is still set for the two forms core AADL can express: an integer literal and an unindexed property constant. Validation no longer asks whether the declarative model can supply a value, since that is not a question about the legality of the declaration.Reading the branch commit by commit, note that
a939c9d87eintroduced the element-prefixed evaluation andeb16aaf6b4removes it again; the net diff is the unevaluated representation.8765cbc1d2then removes property value readers inorg.osate.utils.internal.PropertyUtilsthat nothing in the reactor calls: twenty-two public methods and the privategetUnithelper onlysetFloatValueused. The eight methods the Behavior Annex uses stay.Regression models and assertions
models/issue3208/— an array size written as a reference expression with no property tail; asserts the D.3 error.models/issue3210/Issue3210.aadl—byLiteral[8],byConstant[# AADL_Project::Max_Queue_Size],byPrefixed[input#Queue_Size]. Asserts that the literal and the constant also reach the inheritedaadl2::ArraySizeextent, and that the prefixed reference keeps its own form as aClassifierFeaturePropertyReferencenaminginputandQueue_Sizewith the core extent left unset. The prefixed feature declaresQueue_Size => 8, so a translation that read the property would have frozen that 8.models/issue3210/BareProperty.aadl— a bare property definition as a size; now accepted and kept as aPropertySetPropertyReference.models/issue3210/ContainedProperty.aadl— the extent comes fromQueue_Size => 16 applies to worker.inputin the enclosing process implementation, a two-element containment path. Declarative lookup cannot see it and answered with the property default of 1; the assertion requires the reference to be kept with no extent read.Corpus goldens are regenerated. The
resolved-modelprojections change shape (size : BehaviorArraySizewith itsintegerValuechild) for every model with an array dimension, andBareProperty's validated diagnostics lose the evaluability error.Validation
Clean root reactor, run outside the sandbox:
BUILD SUCCESS, 143 modules, no failures or errors.org.osate.ba.tests: 119 tests, 0 failures, 5 pre-existing conformance skips, includingIssue3210Test(4) andIssue3176Test(3). Goldens verified with regeneration off after regenerating.Dependencies and merge order
No dependency on an unmerged change; the branch is based on
masteratd2899cc7a4. PR for #3211 is based on this branch and should merge after it.Residual risk
This PR removes exported API and does not carry the version change.
org.osate.utils.internalis exported, andorg.osate.bare-exports the requirement, so the twenty-two removed public methods were reachable by external Behavior Annex tooling.org.osate.utilsis at 2.1.0 and both requiring bundles ask for[2.1.0,3.0.0); a major bump to 3.0.0 with the consumer ranges widened is required throughreleng/version-management/before merge, and is deliberately not hand-edited here.Other risks:
aadlbaclassifier IDs after it shift. That is generated renumbering, not a source change, but anything binding to those integers rather than toAadlBaPackage.Literalswould need rebuilding.BehaviorArraySizeImpl.getAadlBaLocationReferenceis hand-written in generated code, as in every BA implementation that extends an aadl2 implementation, and must survive future regeneration.🤖 Generated with Claude Code