feature-value-is-initial
Available in: KerML, SysML
This checks that initial feature values are only owned by variable features.
Specification
If a
FeatureValuehasis_initial = true, then itsfeature_with_valuemust haveis_variable = true.
Example
class A {
feature a := 0; // error
}
Or
attribute def A {
attribute a := 5; // error
}
Instead, use default value:
class A {
feature a default 0; // ok
}
Or make the feature variable (KerML only):
class A {
var feature a := 0; // ok
}
In SysML, features are implicitly variable if they are
not
portion(neithersnapshotnortimeslice)neither binding connector nor succession
not composite action usage, implicitly or explicitly
owned by an occurrence
does not specialize either
Links::SelfLinksorOccurrences::HappensLink