diff --git a/ba/doc/conformance.md b/ba/doc/conformance.md index 826f57c67e..1a3a25799e 100644 --- a/ba/doc/conformance.md +++ b/ba/doc/conformance.md @@ -208,6 +208,8 @@ These are bounded findings from the inspected grammar/translator/checker path. E Some checker comments identify their source as **AADL Behavior Annex draft 0.94**. This matters: names such as `D_3_L1_And_L2_Check` and diagnostics labelled `D.3.(L3)` cannot be assumed to correspond one-for-one to the supplied Rev. A rule ordering. `D_3_L4_Check` is explicitly suspended and returns true with its body commented out. The Rev. A text makes explicit initialization/finalization modeling optional, so suspension of an older check is not automatically a Rev. A defect. Update the traceability by rule meaning before reviving old checks. +**Complete states in modal components ([#2279](https://github.com/osate/osate2/issues/2279)):** D.3 requires initial and complete states in threads, devices, and other components that can suspend awaiting dispatch or a mode transition. `D_3_L3_Check` previously checked only threads, devices, and virtual processors. It now also checks non-subprogram classifiers with modes, including inherited modes. The driver runs the required-state checks even when the entire states section is omitted, including the initial/final-state requirements for subprograms; empty and variables-only annexes are covered by the regression. This does not require memory state names to match mode names: mode refinement remains optional, with the existing all-or-none rule applying once a complete state represents a mode. `Issue2279Test` covers missing states across modal component categories, inherited memory modes, legal external transitions between mode-representing complete states, and complete states that do not represent modes. The corrected device-dispatch example from #2279 already validates successfully and is retained as a positive control; its historical intermittent property-resolution failure was not reproduced. + ## What the existing tests do and do not prove 1. ~~**The conformance diagnostic assertions are ineffective.**~~ `BehaviorAnnexConformanceTest.assertDiagnostics` took an `expected` list but never used it; it checked only `result.getIssues() != null`, so nine active diagnostic-based tests could not fail, and their expected strings had drifted to messages the current parser no longer produces. **Repaired in step 1** (see below): that method is gone, the class states standard outcomes only, and exact diagnostics are compared by the golden suites. diff --git a/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_Controls.txt b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_Controls.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_Issue2279.txt b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_Issue2279.txt new file mode 100644 index 0000000000..7364db3263 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_Issue2279.txt @@ -0,0 +1,3 @@ +error | semantic | 38 | 2 | 94 | Issue2279::brain.missing_complete has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 62 | 2 | 34 | Issue2279::inherited.missing_initial has no initial state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 69 | 2 | 37 | Issue2279::brain.extended has no complete state : Behavior Annex D.3.(L3) legality rule failed. diff --git a/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_MissingStates.txt b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_MissingStates.txt new file mode 100644 index 0000000000..5cc73472b7 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_MissingStates.txt @@ -0,0 +1,12 @@ +error | semantic | 1 | 1 | 0 | MissingStates::routine has no final state : Behavior Annex D.3.(L1) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::routine has no initialstate : Behavior Annex D.3.(L1) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::scheduler has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::scheduler has no initial state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::sensor has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::sensor has no initial state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::storage has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::storage has no initial state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::worker has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 1 | 1 | 0 | MissingStates::worker has no initial state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 48 | 2 | 45 | MissingStates::storage.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 48 | 2 | 45 | MissingStates::storage.impl has no initial state : Behavior Annex D.3.(L3) legality rule failed. diff --git a/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_ModalCategories.txt b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_ModalCategories.txt new file mode 100644 index 0000000000..c759003eca --- /dev/null +++ b/ba/org.osate.ba.tests/expected/diagnostics-validated/org.osate.ba.tests_models_issue2279_ModalCategories.txt @@ -0,0 +1,24 @@ +error | semantic | 101 | 2 | 37 | ModalCategories::memory_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 110 | 2 | 37 | ModalCategories::process_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 117 | 2 | 37 | ModalCategories::process_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 126 | 2 | 37 | ModalCategories::processor_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 133 | 2 | 37 | ModalCategories::processor_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 142 | 2 | 37 | ModalCategories::system_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 149 | 2 | 37 | ModalCategories::system_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 158 | 2 | 37 | ModalCategories::thread_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 165 | 2 | 37 | ModalCategories::thread_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 174 | 2 | 37 | ModalCategories::thread_group_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 181 | 2 | 37 | ModalCategories::thread_group_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 190 | 2 | 37 | ModalCategories::virtual_bus_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 197 | 2 | 37 | ModalCategories::virtual_bus_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 206 | 2 | 37 | ModalCategories::virtual_processor_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 213 | 2 | 37 | ModalCategories::virtual_processor_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 30 | 2 | 37 | ModalCategories::abstract_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 37 | 2 | 37 | ModalCategories::abstract_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 46 | 2 | 37 | ModalCategories::bus_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 53 | 2 | 37 | ModalCategories::bus_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 62 | 2 | 37 | ModalCategories::data_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 69 | 2 | 37 | ModalCategories::data_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 78 | 2 | 37 | ModalCategories::device_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 85 | 2 | 37 | ModalCategories::device_behavior.impl has no complete state : Behavior Annex D.3.(L3) legality rule failed. +error | semantic | 94 | 2 | 37 | ModalCategories::memory_behavior has no complete state : Behavior Annex D.3.(L3) legality rule failed. diff --git a/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_Controls.txt b/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_Controls.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_Issue2279.txt b/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_Issue2279.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_MissingStates.txt b/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_MissingStates.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_ModalCategories.txt b/ba/org.osate.ba.tests/expected/diagnostics/org.osate.ba.tests_models_issue2279_ModalCategories.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_Controls.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_Controls.txt new file mode 100644 index 0000000000..3e13dfdb11 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_Controls.txt @@ -0,0 +1,38 @@ +annex[0] owner=Controls::stomach + (BehaviorAnnex, behavior_specification, 1995, 152) + (BehaviorCondition, , 2083, 11) + (BehaviorCondition, , 2125, 11) + (BehaviorIntegerLiteral, , 2093, 1) + (BehaviorState, hungry, 2004, 6) + (BehaviorState, not_hungry, 2030, 10) + (BehaviorStateGroup, , 2004, 23) + (BehaviorStateGroup, , 2030, 28) + (BehaviorTransition, , 2074, 35) + (BehaviorTransition, , 2112, 35) + (BinaryExpression, , 2083, 11) + (DispatchCondition, , 2128, 8) + (ExecuteCondition, , 2083, 11) + (Reference, , 2083, 7) + (ReferenceExpression, , 2083, 7) + (ReferenceSegment, food_in, 2083, 7) +annex[1] owner=Controls::brain + (BehaviorAnnex, behavior_specification, 2312, 94) + (BehaviorState, finished, 2346, 8) + (BehaviorState, start, 2321, 5) + (BehaviorStateGroup, , 2321, 22) + (BehaviorStateGroup, , 2346, 23) + (BehaviorTransition, , 2385, 21) +annex[2] owner=Controls::routine + (BehaviorAnnex, behavior_specification, 2577, 94) + (BehaviorState, finished, 2611, 8) + (BehaviorState, start, 2586, 5) + (BehaviorStateGroup, , 2586, 22) + (BehaviorStateGroup, , 2611, 23) + (BehaviorTransition, , 2650, 21) +annex[3] owner=Controls::controller + (BehaviorAnnex, behavior_specification, 2855, 103) + (BehaviorState, finished, 2889, 8) + (BehaviorState, start, 2864, 5) + (BehaviorStateGroup, , 2864, 22) + (BehaviorStateGroup, , 2889, 32) + (BehaviorTransition, , 2937, 21) diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_Issue2279.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_Issue2279.txt new file mode 100644 index 0000000000..33b14c8c29 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_Issue2279.txt @@ -0,0 +1,28 @@ +annex[0] owner=Issue2279::brain.missing_complete + (BehaviorAnnex, behavior_specification, 2068, 94) + (BehaviorState, finished, 2102, 8) + (BehaviorState, start, 2077, 5) + (BehaviorStateGroup, , 2077, 22) + (BehaviorStateGroup, , 2102, 23) + (BehaviorTransition, , 2141, 21) +annex[1] owner=Issue2279::brain.corrected + (BehaviorAnnex, behavior_specification, 2368, 113) + (BehaviorCondition, , 2463, 7) + (BehaviorState, active, 2413, 6) + (BehaviorState, resting, 2377, 7) + (BehaviorStateGroup, , 2377, 33) + (BehaviorStateGroup, , 2413, 24) + (BehaviorTransition, , 2453, 28) + (ModeSwitchCondition, , 2466, 4) + (ModeSwitchConjunction, , 2466, 4) + (ModeSwitchTrigger, , 2466, 4) + (Reference, , 2466, 4) + (ReferenceSegment, wake, 2466, 4) +annex[2] owner=Issue2279::inherited.missing_initial + (BehaviorAnnex, behavior_specification, 2638, 34) + (BehaviorState, resting, 2647, 7) + (BehaviorStateGroup, , 2647, 25) +annex[3] owner=Issue2279::brain.extended + (BehaviorAnnex, behavior_specification, 2805, 37) + (BehaviorState, start, 2814, 5) + (BehaviorStateGroup, , 2814, 28) diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_MissingStates.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_MissingStates.txt new file mode 100644 index 0000000000..0a5ca40c09 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_MissingStates.txt @@ -0,0 +1,17 @@ +annex[0] owner=MissingStates::worker + (BehaviorAnnex, behavior_specification, 0, 1835) +annex[1] owner=MissingStates::sensor + (BehaviorAnnex, behavior_specification, 0, 1900) +annex[2] owner=MissingStates::scheduler + (BehaviorAnnex, behavior_specification, 0, 1979) +annex[3] owner=MissingStates::storage + (BehaviorAnnex, behavior_specification, 0, 2078) +annex[4] owner=MissingStates::storage.impl + (BehaviorAnnex, behavior_specification, 2252, 45) + (BehaviorIntegerLiteral, , 2295, 1) + (BehaviorVariable, value, 2264, 5) + (BehaviorVariableGroup, , 2264, 33) +annex[5] owner=MissingStates::routine + (BehaviorAnnex, behavior_specification, 0, 2492) +annex[6] owner=MissingStates::nonmodal + (BehaviorAnnex, behavior_specification, 0, 2624) diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_ModalCategories.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_ModalCategories.txt new file mode 100644 index 0000000000..8e556c72e5 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue2279_ModalCategories.txt @@ -0,0 +1,96 @@ +annex[0] owner=ModalCategories::abstract_behavior + (BehaviorAnnex, behavior_specification, 1864, 37) + (BehaviorState, start, 1873, 5) + (BehaviorStateGroup, , 1873, 28) +annex[1] owner=ModalCategories::abstract_behavior.impl + (BehaviorAnnex, behavior_specification, 2012, 37) + (BehaviorState, start, 2021, 5) + (BehaviorStateGroup, , 2021, 28) +annex[2] owner=ModalCategories::bus_behavior + (BehaviorAnnex, behavior_specification, 2165, 37) + (BehaviorState, start, 2174, 5) + (BehaviorStateGroup, , 2174, 28) +annex[3] owner=ModalCategories::bus_behavior.impl + (BehaviorAnnex, behavior_specification, 2298, 37) + (BehaviorState, start, 2307, 5) + (BehaviorStateGroup, , 2307, 28) +annex[4] owner=ModalCategories::data_behavior + (BehaviorAnnex, behavior_specification, 2448, 37) + (BehaviorState, start, 2457, 5) + (BehaviorStateGroup, , 2457, 28) +annex[5] owner=ModalCategories::data_behavior.impl + (BehaviorAnnex, behavior_specification, 2584, 37) + (BehaviorState, start, 2593, 5) + (BehaviorStateGroup, , 2593, 28) +annex[6] owner=ModalCategories::device_behavior + (BehaviorAnnex, behavior_specification, 2739, 37) + (BehaviorState, start, 2748, 5) + (BehaviorStateGroup, , 2748, 28) +annex[7] owner=ModalCategories::device_behavior.impl + (BehaviorAnnex, behavior_specification, 2881, 37) + (BehaviorState, start, 2890, 5) + (BehaviorStateGroup, , 2890, 28) +annex[8] owner=ModalCategories::memory_behavior + (BehaviorAnnex, behavior_specification, 3038, 37) + (BehaviorState, start, 3047, 5) + (BehaviorStateGroup, , 3047, 28) +annex[9] owner=ModalCategories::memory_behavior.impl + (BehaviorAnnex, behavior_specification, 3180, 37) + (BehaviorState, start, 3189, 5) + (BehaviorStateGroup, , 3189, 28) +annex[10] owner=ModalCategories::process_behavior + (BehaviorAnnex, behavior_specification, 3339, 37) + (BehaviorState, start, 3348, 5) + (BehaviorStateGroup, , 3348, 28) +annex[11] owner=ModalCategories::process_behavior.impl + (BehaviorAnnex, behavior_specification, 3484, 37) + (BehaviorState, start, 3493, 5) + (BehaviorStateGroup, , 3493, 28) +annex[12] owner=ModalCategories::processor_behavior + (BehaviorAnnex, behavior_specification, 3648, 37) + (BehaviorState, start, 3657, 5) + (BehaviorStateGroup, , 3657, 28) +annex[13] owner=ModalCategories::processor_behavior.impl + (BehaviorAnnex, behavior_specification, 3799, 37) + (BehaviorState, start, 3808, 5) + (BehaviorStateGroup, , 3808, 28) +annex[14] owner=ModalCategories::system_behavior + (BehaviorAnnex, behavior_specification, 3959, 37) + (BehaviorState, start, 3968, 5) + (BehaviorStateGroup, , 3968, 28) +annex[15] owner=ModalCategories::system_behavior.impl + (BehaviorAnnex, behavior_specification, 4101, 37) + (BehaviorState, start, 4110, 5) + (BehaviorStateGroup, , 4110, 28) +annex[16] owner=ModalCategories::thread_behavior + (BehaviorAnnex, behavior_specification, 4258, 37) + (BehaviorState, start, 4267, 5) + (BehaviorStateGroup, , 4267, 28) +annex[17] owner=ModalCategories::thread_behavior.impl + (BehaviorAnnex, behavior_specification, 4400, 37) + (BehaviorState, start, 4409, 5) + (BehaviorStateGroup, , 4409, 28) +annex[18] owner=ModalCategories::thread_group_behavior + (BehaviorAnnex, behavior_specification, 4569, 37) + (BehaviorState, start, 4578, 5) + (BehaviorStateGroup, , 4578, 28) +annex[19] owner=ModalCategories::thread_group_behavior.impl + (BehaviorAnnex, behavior_specification, 4729, 37) + (BehaviorState, start, 4738, 5) + (BehaviorStateGroup, , 4738, 28) +annex[20] owner=ModalCategories::virtual_bus_behavior + (BehaviorAnnex, behavior_specification, 4902, 37) + (BehaviorState, start, 4911, 5) + (BehaviorStateGroup, , 4911, 28) +annex[21] owner=ModalCategories::virtual_bus_behavior.impl + (BehaviorAnnex, behavior_specification, 5059, 37) + (BehaviorState, start, 5068, 5) + (BehaviorStateGroup, , 5068, 28) +annex[22] owner=ModalCategories::virtual_processor_behavior + (BehaviorAnnex, behavior_specification, 5243, 37) + (BehaviorState, start, 5252, 5) + (BehaviorStateGroup, , 5252, 28) +annex[23] owner=ModalCategories::virtual_processor_behavior.impl + (BehaviorAnnex, behavior_specification, 5418, 37) + (BehaviorState, start, 5427, 5) + (BehaviorStateGroup, , 5427, 28) diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt index 7985d951c2..9f93823202 100644 --- a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt @@ -1,7 +1,7 @@ annex[0] owner=InModesExecuteCondition::controller.impl - (BehaviorAnnex, behavior_specification, 1919, 93) + (BehaviorAnnex, behavior_specification, 1919, 102) (BehaviorState, running, 1954, 7) (BehaviorState, waiting, 1927, 7) (BehaviorStateGroup, , 1927, 24) - (BehaviorStateGroup, , 1954, 22) - (BehaviorTransition, , 1990, 22) + (BehaviorStateGroup, , 1954, 31) + (BehaviorTransition, , 1999, 22) diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt index f6a1c54082..ee9b52d81d 100644 --- a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt @@ -1,13 +1,13 @@ annex[0] owner=InModesExternalCondition::controller.impl - (BehaviorAnnex, behavior_specification, 1950, 98) - (BehaviorCondition, , 2031, 5) + (BehaviorAnnex, behavior_specification, 1950, 107) + (BehaviorCondition, , 2040, 5) (BehaviorState, running, 1985, 7) (BehaviorState, waiting, 1958, 7) (BehaviorStateGroup, , 1958, 24) - (BehaviorStateGroup, , 1985, 22) - (BehaviorTransition, , 2021, 27) - (ModeSwitchCondition, , 2034, 2) - (ModeSwitchConjunction, , 2034, 2) - (ModeSwitchTrigger, , 2034, 2) - (Reference, , 2034, 2) - (ReferenceSegment, go, 2034, 2) + (BehaviorStateGroup, , 1985, 31) + (BehaviorTransition, , 2030, 27) + (ModeSwitchCondition, , 2043, 2) + (ModeSwitchConjunction, , 2043, 2) + (ModeSwitchTrigger, , 2043, 2) + (Reference, , 2043, 2) + (ReferenceSegment, go, 2043, 2) diff --git a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt index c85440968c..b39218c0e6 100644 --- a/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt +++ b/ba/org.osate.ba.tests/expected/positions/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt @@ -1,12 +1,12 @@ annex[0] owner=ModalSubclauses::modal.impl - (BehaviorAnnex, behavior_specification, 1914, 35) + (BehaviorAnnex, behavior_specification, 1914, 44) (BehaviorState, whennormal, 1922, 10) - (BehaviorStateGroup, , 1922, 27) + (BehaviorStateGroup, , 1922, 36) annex[1] owner=ModalSubclauses::modal.impl - (BehaviorAnnex, behavior_specification, 2006, 35) - (BehaviorState, whenbackup, 2014, 10) - (BehaviorStateGroup, , 2014, 27) + (BehaviorAnnex, behavior_specification, 2015, 44) + (BehaviorState, whenbackup, 2023, 10) + (BehaviorStateGroup, , 2023, 36) annex[2] owner=ModalSubclauses::modal.always - (BehaviorAnnex, behavior_specification, 2198, 32) - (BehaviorState, anymode, 2206, 7) - (BehaviorStateGroup, , 2206, 24) + (BehaviorAnnex, behavior_specification, 2216, 41) + (BehaviorState, anymode, 2224, 7) + (BehaviorStateGroup, , 2224, 33) diff --git a/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_Controls.txt b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_Controls.txt new file mode 100644 index 0000000000..4e8bcf1d44 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_Controls.txt @@ -0,0 +1,32 @@ +annex[0] owner=Controls::stomach + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=hungry + states[1] : BehaviorState name=not_hungry + transitions[0] : BehaviorTransition + condition : ValueExpression + relations[0] : Relation + firstExpression : SimpleExpression + terms[0] : Term + factors[0] : Factor + firstValue : EventDataPortHolder element=Controls::stomach.food_in [EventDataPort] + secondExpression : SimpleExpression + terms[0] : Term + factors[0] : Factor + firstValue : BehaviorIntegerLiteral + transitions[1] : BehaviorTransition + condition : DispatchCondition +annex[1] owner=Controls::brain + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start + states[1] : BehaviorState name=finished + transitions[0] : BehaviorTransition +annex[2] owner=Controls::routine + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start + states[1] : BehaviorState name=finished + transitions[0] : BehaviorTransition +annex[3] owner=Controls::controller + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start + states[1] : BehaviorState name=finished + transitions[0] : BehaviorTransition diff --git a/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_Issue2279.txt b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_Issue2279.txt new file mode 100644 index 0000000000..2d1c0ca0c5 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_Issue2279.txt @@ -0,0 +1,19 @@ +annex[0] owner=Issue2279::brain.missing_complete + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start + states[1] : BehaviorState name=finished + transitions[0] : BehaviorTransition +annex[1] owner=Issue2279::brain.corrected + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=resting + states[1] : BehaviorState name=active + transitions[0] : BehaviorTransition + condition : ModeSwitchTriggerLogicalExpression + modeSwitchConjunctions[0] : ModeSwitchConjunction + modeSwitchTriggers[0] : EventPortHolder element=Issue2279::brain.wake [EventPort] +annex[2] owner=Issue2279::inherited.missing_initial + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=resting +annex[3] owner=Issue2279::brain.extended + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start diff --git a/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_MissingStates.txt b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_MissingStates.txt new file mode 100644 index 0000000000..727fff7c52 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_MissingStates.txt @@ -0,0 +1,16 @@ +annex[0] owner=MissingStates::worker + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification +annex[1] owner=MissingStates::sensor + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification +annex[2] owner=MissingStates::scheduler + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification +annex[3] owner=MissingStates::storage + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification +annex[4] owner=MissingStates::storage.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + variables[0] : BehaviorVariable name=value + ownedValueConstant : BehaviorIntegerLiteral +annex[5] owner=MissingStates::routine + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification +annex[6] owner=MissingStates::nonmodal + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification diff --git a/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_ModalCategories.txt b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_ModalCategories.txt new file mode 100644 index 0000000000..865c52e00f --- /dev/null +++ b/ba/org.osate.ba.tests/expected/resolved-model/org.osate.ba.tests_models_issue2279_ModalCategories.txt @@ -0,0 +1,72 @@ +annex[0] owner=ModalCategories::abstract_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[1] owner=ModalCategories::abstract_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[2] owner=ModalCategories::bus_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[3] owner=ModalCategories::bus_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[4] owner=ModalCategories::data_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[5] owner=ModalCategories::data_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[6] owner=ModalCategories::device_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[7] owner=ModalCategories::device_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[8] owner=ModalCategories::memory_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[9] owner=ModalCategories::memory_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[10] owner=ModalCategories::process_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[11] owner=ModalCategories::process_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[12] owner=ModalCategories::processor_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[13] owner=ModalCategories::processor_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[14] owner=ModalCategories::system_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[15] owner=ModalCategories::system_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[16] owner=ModalCategories::thread_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[17] owner=ModalCategories::thread_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[18] owner=ModalCategories::thread_group_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[19] owner=ModalCategories::thread_group_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[20] owner=ModalCategories::virtual_bus_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[21] owner=ModalCategories::virtual_bus_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[22] owner=ModalCategories::virtual_processor_behavior + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start +annex[23] owner=ModalCategories::virtual_processor_behavior.impl + parsedAnnexSubclause : BehaviorAnnex name=behavior_specification + states[0] : BehaviorState name=start diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_Controls.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_Controls.txt new file mode 100644 index 0000000000..1a6001b507 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_Controls.txt @@ -0,0 +1,37 @@ +===== annex[0] owner=Controls::stomach ===== + +\tstates +\t\thungry : initial state; +\t\tnot_hungry : complete state; +\ttransitions +\t\thungry -[food_in = 1]-> not_hungry; +\t\tnot_hungry -[on dispatch]-> hungry; +----- Xtext reparse ----- +reparsed +===== annex[1] owner=Controls::brain ===== + +\tstates +\t\tstart : initial state; +\t\tfinished : final state; +\ttransitions +\t\tstart -[]-> finished; +----- Xtext reparse ----- +reparsed +===== annex[2] owner=Controls::routine ===== + +\tstates +\t\tstart : initial state; +\t\tfinished : final state; +\ttransitions +\t\tstart -[]-> finished; +----- Xtext reparse ----- +reparsed +===== annex[3] owner=Controls::controller ===== + +\tstates +\t\tstart : initial state; +\t\tfinished : complete final state; +\ttransitions +\t\tstart -[]-> finished; +----- Xtext reparse ----- +reparsed diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_Issue2279.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_Issue2279.txt new file mode 100644 index 0000000000..a7a58d9645 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_Issue2279.txt @@ -0,0 +1,30 @@ +===== annex[0] owner=Issue2279::brain.missing_complete ===== + +\tstates +\t\tstart : initial state; +\t\tfinished : final state; +\ttransitions +\t\tstart -[]-> finished; +----- Xtext reparse ----- +reparsed +===== annex[1] owner=Issue2279::brain.corrected ===== + +\tstates +\t\tresting : initial complete state; +\t\tactive : complete state; +\ttransitions +\t\tresting -[on wake]-> active; +----- Xtext reparse ----- +reparsed +===== annex[2] owner=Issue2279::inherited.missing_initial ===== + +\tstates +\t\tresting : complete state; +----- Xtext reparse ----- +reparsed +===== annex[3] owner=Issue2279::brain.extended ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_MissingStates.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_MissingStates.txt new file mode 100644 index 0000000000..21c52a534f --- /dev/null +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_MissingStates.txt @@ -0,0 +1,30 @@ +===== annex[0] owner=MissingStates::worker ===== + +----- Xtext reparse ----- +reparsed +===== annex[1] owner=MissingStates::sensor ===== + +----- Xtext reparse ----- +reparsed +===== annex[2] owner=MissingStates::scheduler ===== + +----- Xtext reparse ----- +reparsed +===== annex[3] owner=MissingStates::storage ===== + +----- Xtext reparse ----- +reparsed +===== annex[4] owner=MissingStates::storage.impl ===== + +\tvariables +\t\tvalue : Base_Types::Integer := 0; +----- Xtext reparse ----- +reparsed +===== annex[5] owner=MissingStates::routine ===== + +----- Xtext reparse ----- +reparsed +===== annex[6] owner=MissingStates::nonmodal ===== + +----- Xtext reparse ----- +reparsed diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_ModalCategories.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_ModalCategories.txt new file mode 100644 index 0000000000..12702ca088 --- /dev/null +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue2279_ModalCategories.txt @@ -0,0 +1,144 @@ +===== annex[0] owner=ModalCategories::abstract_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[1] owner=ModalCategories::abstract_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[2] owner=ModalCategories::bus_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[3] owner=ModalCategories::bus_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[4] owner=ModalCategories::data_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[5] owner=ModalCategories::data_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[6] owner=ModalCategories::device_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[7] owner=ModalCategories::device_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[8] owner=ModalCategories::memory_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[9] owner=ModalCategories::memory_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[10] owner=ModalCategories::process_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[11] owner=ModalCategories::process_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[12] owner=ModalCategories::processor_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[13] owner=ModalCategories::processor_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[14] owner=ModalCategories::system_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[15] owner=ModalCategories::system_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[16] owner=ModalCategories::thread_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[17] owner=ModalCategories::thread_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[18] owner=ModalCategories::thread_group_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[19] owner=ModalCategories::thread_group_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[20] owner=ModalCategories::virtual_bus_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[21] owner=ModalCategories::virtual_bus_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[22] owner=ModalCategories::virtual_processor_behavior ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed +===== annex[23] owner=ModalCategories::virtual_processor_behavior.impl ===== + +\tstates +\t\tstart : initial final state; +----- Xtext reparse ----- +reparsed diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt index a2e53d9abf..7d48345438 100644 --- a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExecuteCondition.txt @@ -2,7 +2,7 @@ states \twaiting : initial state; -\t\trunning : final state; +\t\trunning : complete final state; transitions \twaiting -[]-> running; ----- Xtext reparse ----- diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt index f615cb3624..483b64939a 100644 --- a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_InModesExternalCondition.txt @@ -2,7 +2,7 @@ states \twaiting : initial state; -\t\trunning : final state; +\t\trunning : complete final state; transitions \twaiting -[on go]-> running; ----- Xtext reparse ----- diff --git a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt index 8eedc2a22d..36221aed3e 100644 --- a/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt +++ b/ba/org.osate.ba.tests/expected/unparse/org.osate.ba.tests_models_issue3186_ModalSubclauses.txt @@ -1,18 +1,18 @@ ===== annex[0] owner=ModalSubclauses::modal.impl ===== states -\twhennormal : initial state; +\twhennormal : initial complete state; ----- Xtext reparse ----- reparsed ===== annex[1] owner=ModalSubclauses::modal.impl ===== states -\twhenbackup : initial state; +\twhenbackup : initial complete state; ----- Xtext reparse ----- reparsed ===== annex[2] owner=ModalSubclauses::modal.always ===== states -\tanymode : initial state; +\tanymode : initial complete state; ----- Xtext reparse ----- reparsed diff --git a/ba/org.osate.ba.tests/models/issue2279/.gitignore b/ba/org.osate.ba.tests/models/issue2279/.gitignore new file mode 100644 index 0000000000..afce51184c --- /dev/null +++ b/ba/org.osate.ba.tests/models/issue2279/.gitignore @@ -0,0 +1,2 @@ +/.aadlbin-gen/ +/instances/ diff --git a/ba/org.osate.ba.tests/models/issue2279/.project b/ba/org.osate.ba.tests/models/issue2279/.project new file mode 100644 index 0000000000..8d7e7b506f --- /dev/null +++ b/ba/org.osate.ba.tests/models/issue2279/.project @@ -0,0 +1,8 @@ + + + issue2279 + + + org.eclipse.xtext.ui.shared.xtextBuilder + org.osate.core.aadlnatureorg.eclipse.xtext.ui.shared.xtextNature + diff --git a/ba/org.osate.ba.tests/models/issue2279/Controls.aadl b/ba/org.osate.ba.tests/models/issue2279/Controls.aadl new file mode 100644 index 0000000000..c957861186 --- /dev/null +++ b/ba/org.osate.ba.tests/models/issue2279/Controls.aadl @@ -0,0 +1,76 @@ +-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file). +-- All Rights Reserved. +-- +-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY +-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE +-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT +-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. +-- +-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 +-- which is available at https://www.eclipse.org/legal/epl-2.0/ +-- SPDX-License-Identifier: EPL-2.0 +-- +-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file). +-- +-- This program includes and/or can make use of certain third party source code, object code, documentation and other +-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system +-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and +-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party +-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici- +-- aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li- +-- censes only apply to the Third Party Software and not any other portion of this program or this program as a whole. + +package Controls +public +with Base_Types; + +-- The corrected device example from #2279 must accept dispatch without an explicit Dispatch_Protocol. +device stomach +features + food_in : in event data port Base_Types::Integer; +annex behavior_specification {** + states + hungry : initial state; + not_hungry : complete state; + transitions + hungry -[food_in = 1]-> not_hungry; + not_hungry -[on dispatch]-> hungry; +**}; +end stomach; + +-- Without modes or dispatch, an initialization-to-finalization behavior needs no complete state. +memory brain +annex behavior_specification {** + states + start : initial state; + finished : final state; + transitions + start -[]-> finished; +**}; +end brain; + +-- Modes do not change the subprogram prohibition on complete states. +subprogram routine +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial state; + finished : final state; + transitions + start -[]-> finished; +**}; +end routine; +-- Complete states need not represent modes when none of them uses a mode's name. +process controller +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial state; + finished : complete final state; + transitions + start -[]-> finished; +**}; +end controller; +end Controls; diff --git a/ba/org.osate.ba.tests/models/issue2279/Issue2279.aadl b/ba/org.osate.ba.tests/models/issue2279/Issue2279.aadl new file mode 100644 index 0000000000..90811f74ac --- /dev/null +++ b/ba/org.osate.ba.tests/models/issue2279/Issue2279.aadl @@ -0,0 +1,73 @@ +-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file). +-- All Rights Reserved. +-- +-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY +-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE +-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT +-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. +-- +-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 +-- which is available at https://www.eclipse.org/legal/epl-2.0/ +-- SPDX-License-Identifier: EPL-2.0 +-- +-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file). +-- +-- This program includes and/or can make use of certain third party source code, object code, documentation and other +-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system +-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and +-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party +-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici- +-- aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li- +-- censes only apply to the Third Party Software and not any other portion of this program or this program as a whole. + +package Issue2279 +public + +memory brain +features + wake : in event port; +modes + resting : initial mode; + active : mode; + resting -[wake]-> active; +end brain; + +-- The modes come from the type, and neither state is an execution state that could block. +memory implementation brain.missing_complete +annex behavior_specification {** + states + start : initial state; + finished : final state; + transitions + start -[]-> finished; +**}; +end brain.missing_complete; + +-- A complete state that represents a mode leaves on the mode's external trigger, not on dispatch. +memory implementation brain.corrected +annex behavior_specification {** + states + resting : initial complete state; + active : complete state; + transitions + resting -[on wake]-> active; +**}; +end brain.corrected; + +memory inherited extends brain +end inherited; + +memory implementation inherited.missing_initial +annex behavior_specification {** + states + resting : complete state; +**}; +end inherited.missing_initial; + +memory implementation brain.extended extends brain.corrected +annex behavior_specification {** + states + start : initial final state; +**}; +end brain.extended; +end Issue2279; diff --git a/ba/org.osate.ba.tests/models/issue2279/MissingStates.aadl b/ba/org.osate.ba.tests/models/issue2279/MissingStates.aadl new file mode 100644 index 0000000000..1942bd0652 --- /dev/null +++ b/ba/org.osate.ba.tests/models/issue2279/MissingStates.aadl @@ -0,0 +1,64 @@ +-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file). +-- All Rights Reserved. +-- +-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY +-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE +-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT +-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. +-- +-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 +-- which is available at https://www.eclipse.org/legal/epl-2.0/ +-- SPDX-License-Identifier: EPL-2.0 +-- +-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file). +-- +-- This program includes and/or can make use of certain third party source code, object code, documentation and other +-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system +-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and +-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party +-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici- +-- aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li- +-- censes only apply to the Third Party Software and not any other portion of this program or this program as a whole. + +package MissingStates +public +with Base_Types; + +thread worker +annex behavior_specification {** **}; +end worker; + +device sensor +annex behavior_specification {** **}; +end sensor; + +virtual processor scheduler +annex behavior_specification {** **}; +end scheduler; + +memory storage +modes + normal : initial mode; +annex behavior_specification {** **}; +end storage; + +-- A nonempty annex can also omit its states section; these modes come from the type. +memory implementation storage.impl +annex behavior_specification {** + variables + value : Base_Types::Integer := 0; +**}; +end storage.impl; + +-- Subprograms require initial/final states even though complete states are prohibited. +subprogram routine +modes + normal : initial mode; +annex behavior_specification {** **}; +end routine; + +-- No state requirement applies to a nonmodal memory component. +memory nonmodal +annex behavior_specification {** **}; +end nonmodal; +end MissingStates; diff --git a/ba/org.osate.ba.tests/models/issue2279/ModalCategories.aadl b/ba/org.osate.ba.tests/models/issue2279/ModalCategories.aadl new file mode 100644 index 0000000000..4dde36b35f --- /dev/null +++ b/ba/org.osate.ba.tests/models/issue2279/ModalCategories.aadl @@ -0,0 +1,218 @@ +-- Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file). +-- All Rights Reserved. +-- +-- NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY +-- KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE +-- OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT +-- MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. +-- +-- This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 +-- which is available at https://www.eclipse.org/legal/epl-2.0/ +-- SPDX-License-Identifier: EPL-2.0 +-- +-- Created, in part, with funding and support from the United States Government. (see Acknowledgments file). +-- +-- This program includes and/or can make use of certain third party source code, object code, documentation and other +-- files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system +-- configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and +-- conditions contained in any such Third Party Software or separate license file distributed with such Third Party +-- Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici- +-- aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li- +-- censes only apply to the Third Party Software and not any other portion of this program or this program as a whole. + +package ModalCategories +public + +abstract abstract_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end abstract_behavior; + +abstract implementation abstract_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end abstract_behavior.impl; + +bus bus_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end bus_behavior; + +bus implementation bus_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end bus_behavior.impl; + +data data_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end data_behavior; + +data implementation data_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end data_behavior.impl; + +device device_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end device_behavior; + +device implementation device_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end device_behavior.impl; + +memory memory_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end memory_behavior; + +memory implementation memory_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end memory_behavior.impl; + +process process_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end process_behavior; + +process implementation process_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end process_behavior.impl; + +processor processor_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end processor_behavior; + +processor implementation processor_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end processor_behavior.impl; + +system system_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end system_behavior; + +system implementation system_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end system_behavior.impl; + +thread thread_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end thread_behavior; + +thread implementation thread_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end thread_behavior.impl; + +thread group thread_group_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end thread_group_behavior; + +thread group implementation thread_group_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end thread_group_behavior.impl; + +virtual bus virtual_bus_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end virtual_bus_behavior; + +virtual bus implementation virtual_bus_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end virtual_bus_behavior.impl; + +virtual processor virtual_processor_behavior +modes + normal : initial mode; +annex behavior_specification {** + states + start : initial final state; +**}; +end virtual_processor_behavior; + +virtual processor implementation virtual_processor_behavior.impl +annex behavior_specification {** + states + start : initial final state; +**}; +end virtual_processor_behavior.impl; + +end ModalCategories; diff --git a/ba/org.osate.ba.tests/models/issue3186/InModesExecuteCondition.aadl b/ba/org.osate.ba.tests/models/issue3186/InModesExecuteCondition.aadl index 631beb2297..65d222790c 100644 --- a/ba/org.osate.ba.tests/models/issue3186/InModesExecuteCondition.aadl +++ b/ba/org.osate.ba.tests/models/issue3186/InModesExecuteCondition.aadl @@ -32,7 +32,7 @@ modes annex behavior_specification {** states waiting : initial state; - running : final state; + running : complete final state; transitions waiting -[]-> running; **} in modes (normal); diff --git a/ba/org.osate.ba.tests/models/issue3186/InModesExternalCondition.aadl b/ba/org.osate.ba.tests/models/issue3186/InModesExternalCondition.aadl index 53a9d594db..ea9fe4e518 100644 --- a/ba/org.osate.ba.tests/models/issue3186/InModesExternalCondition.aadl +++ b/ba/org.osate.ba.tests/models/issue3186/InModesExternalCondition.aadl @@ -34,7 +34,7 @@ modes annex behavior_specification {** states waiting : initial state; - running : final state; + running : complete final state; transitions waiting -[on go]-> running; **} in modes (normal); diff --git a/ba/org.osate.ba.tests/models/issue3186/ModalSubclauses.aadl b/ba/org.osate.ba.tests/models/issue3186/ModalSubclauses.aadl index ed25fb20d2..55d7b6040f 100644 --- a/ba/org.osate.ba.tests/models/issue3186/ModalSubclauses.aadl +++ b/ba/org.osate.ba.tests/models/issue3186/ModalSubclauses.aadl @@ -32,11 +32,11 @@ modes backup : mode; annex behavior_specification {** states - whennormal : initial state; + whennormal : initial complete state; **} in modes (normal); annex behavior_specification {** states - whenbackup : initial state; + whenbackup : initial complete state; **} in modes (backup); end modal.impl; @@ -46,7 +46,7 @@ modes backup : mode; annex behavior_specification {** states - anymode : initial state; + anymode : initial complete state; **}; end modal.always; end ModalSubclauses; diff --git a/ba/org.osate.ba.tests/src/org/osate/ba/tests/Issue2279Test.java b/ba/org.osate.ba.tests/src/org/osate/ba/tests/Issue2279Test.java new file mode 100644 index 0000000000..75f2a46d12 --- /dev/null +++ b/ba/org.osate.ba.tests/src/org/osate/ba/tests/Issue2279Test.java @@ -0,0 +1,114 @@ +/** + * Copyright (c) 2004-2026 Carnegie Mellon University and others. (see Contributors file). + * All Rights Reserved. + * + * NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY + * KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE + * OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT + * MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT. + * + * This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 + * which is available at https://www.eclipse.org/legal/epl-2.0/ + * SPDX-License-Identifier: EPL-2.0 + * + * Created, in part, with funding and support from the United States Government. (see Acknowledgments file). + * + * This program includes and/or can make use of certain third party source code, object code, documentation and other + * files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system + * configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and + * conditions contained in any such Third Party Software or separate license file distributed with such Third Party + * Software. The parties who own the Third Party Software ("Third Party Licensors") are intended third party benefici- + * aries to this license with respect to the terms applicable to their Third Party Software. Third Party Software li- + * censes only apply to the Third Party Software and not any other portion of this program or this program as a whole. + */ +package org.osate.ba.tests; + +import static org.junit.Assert.assertEquals; + +import java.util.ArrayList; +import java.util.EnumSet; +import java.util.List; + +import org.eclipse.xtext.diagnostics.Severity; +import org.eclipse.xtext.testing.InjectWith; +import org.eclipse.xtext.testing.XtextRunner; +import org.eclipse.xtext.testing.validation.ValidationTestHelper; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.osate.aadl2.AadlPackage; +import org.osate.aadl2.ComponentCategory; +import org.osate.aadl2.ComponentClassifier; +import org.osate.aadl2.ComponentType; +import org.osate.testsupport.TestHelper; + +import com.google.inject.Inject; +import com.itemis.xtext.testing.XtextTest; + +/** Checks complete states for dispatchable components and components awaiting mode transitions. */ +@RunWith(XtextRunner.class) +@InjectWith(BehaviorAnnexInjectorProvider.class) +public class Issue2279Test extends XtextTest { + private static final String PATH = "org.osate.ba.tests/models/issue2279/"; + + @Inject + private TestHelper testHelper; + + @Inject + private ValidationTestHelper validationHelper; + + @Test + public void modalCategoriesRequireCompleteStatesInTypesAndImplementations() throws Exception { + var root = testHelper.parseFile(PATH + "ModalCategories.aadl"); + var typeCategories = EnumSet.noneOf(ComponentCategory.class); + var implementationCategories = EnumSet.noneOf(ComponentCategory.class); + var messages = new ArrayList(); + for (var classifier : root.getOwnedPublicSection().getOwnedClassifiers()) { + var component = (ComponentClassifier) classifier; + (component instanceof ComponentType ? typeCategories : implementationCategories).add(component.getCategory()); + messages.add(missingState(component.getQualifiedName(), "complete")); + } + var expected = EnumSet.complementOf(EnumSet.of(ComponentCategory.SUBPROGRAM_GROUP, ComponentCategory.SUBPROGRAM)); + assertDiagnostics(root, messages); + assertEquals(expected, typeCategories); + assertEquals(expected, implementationCategories); + } + + @Test + public void modalMemoryRequiresInitialAndCompleteStatesIncludingInheritedModes() throws Exception { + assertDiagnostics(testHelper.parseFile(PATH + "Issue2279.aadl"), List.of( + missingState("Issue2279::brain.missing_complete", "complete"), + missingState("Issue2279::inherited.missing_initial", "initial"), + missingState("Issue2279::brain.extended", "complete"))); + } + + @Test + public void omittedStatesSectionStillReportsRequiredStates() throws Exception { + var messages = new ArrayList(); + for (var classifier : List.of("worker", "sensor", "scheduler", "storage", "storage.impl")) { + messages.add(missingState("MissingStates::" + classifier, "initial")); + messages.add(missingState("MissingStates::" + classifier, "complete")); + } + messages.add("MissingStates::routine has no initialstate : Behavior Annex D.3.(L1) legality rule failed."); + messages.add("MissingStates::routine has no final state : Behavior Annex D.3.(L1) legality rule failed."); + assertDiagnostics(testHelper.parseFile(PATH + "MissingStates.aadl"), messages); + } + + @Test + public void deviceDispatchNonmodalMemoryAndModalSubprogramRemainValid() throws Exception { + validationHelper.assertNoIssues(testHelper.parseFile(PATH + "Controls.aadl")); + } + + private static String missingState(String classifier, String kind) { + return classifier + " has no " + kind + " state : Behavior Annex D.3.(L3) legality rule failed."; + } + + private void assertDiagnostics(AadlPackage root, List messages) { + var issues = validationHelper.validate(root); + assertEquals(messages.stream().sorted().toList(), + issues.stream().map(issue -> issue.getMessage()).sorted().toList()); + for (var issue : issues) { + assertEquals(Severity.ERROR, issue.getSeverity()); + assertEquals("org.osate.xtext.aadl2.ba.checker", issue.getCode()); + } + } +} diff --git a/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaLegalityRulesChecker.java b/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaLegalityRulesChecker.java index 9a02248abc..d767c2e4f4 100644 --- a/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaLegalityRulesChecker.java +++ b/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaLegalityRulesChecker.java @@ -150,18 +150,20 @@ public boolean D_3_L1_And_L2_Check(EList initialStates, EList initialStates, EList completeStates) { boolean result = true; + // Modes may be inherited from an extended classifier or the implementation's type. Subprograms have modes, + // too, but their behavior represents a call and must never contain a complete state. if (_baParentContainer instanceof ThreadClassifier || _baParentContainer instanceof DeviceClassifier - || _baParentContainer instanceof VirtualProcessorClassifier) { + || _baParentContainer instanceof VirtualProcessorClassifier + || !(_baParentContainer instanceof SubprogramClassifier) && !_baParentContainer.getAllModes().isEmpty()) { String reportElements = null; if (initialStates.size() > 1) { diff --git a/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaRulesCheckersDriver.java b/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaRulesCheckersDriver.java index 45a4cb273e..374e5569db 100644 --- a/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaRulesCheckersDriver.java +++ b/ba/org.osate.ba/src/org/osate/ba/analyzers/AadlBaRulesCheckersDriver.java @@ -140,31 +140,29 @@ protected void initSwitches() { public Boolean caseAnnexSubclause(AnnexSubclause object) { boolean result = true; - if (_ba.isSetStates()) { - EList initialStates = new BasicEList(); - EList completeStates = new BasicEList(); - EList finalStates = new BasicEList(); - - for (BehaviorState bs : _ba.getStates()) { - if (bs.isInitial()) { - initialStates.add(bs); - } + EList initialStates = new BasicEList(); + EList completeStates = new BasicEList(); + EList finalStates = new BasicEList(); - if (bs.isComplete()) { - completeStates.add(bs); - } + for (BehaviorState bs : _ba.getStates()) { + if (bs.isInitial()) { + initialStates.add(bs); + } - if (bs.isFinal()) { - finalStates.add(bs); - } - } // End of first for. + if (bs.isComplete()) { + completeStates.add(bs); + } - result &= _legality.D_3_L1_And_L2_Check(initialStates, completeStates, finalStates); - result &= _legality.D_3_L3_Check(initialStates, completeStates); - result &= _legality.D_3_L4_Check(initialStates, finalStates); - result &= _consistency.D_3_C3_Check(_ba); + if (bs.isFinal()) { + finalStates.add(bs); + } + } // End of first for. - } // End of first if. + // An omitted states section must still report any states required by the component's category or modes. + result &= _legality.D_3_L1_And_L2_Check(initialStates, completeStates, finalStates); + result &= _legality.D_3_L3_Check(initialStates, completeStates); + result &= _legality.D_3_L4_Check(initialStates, finalStates); + result &= _consistency.D_3_C3_Check(_ba); if (_ba.isSetTransitions()) { result &= otherwiseCheck(_ba);