You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a metamodel having a root that contains a derived, volatile, unchangeable, transient attribute.
Based on that metamodel, a concrete syntax has been defined and the corresponding parser en ui projects have been generated.
Whenever I try to create a new instance using the generated wizard, it fails due to the fact that the wizard tries to set the value of the derived attribute.
Debugging the generated code leads to this section (from the generated MinimalModelHelper):
publicEObjectgetMinimalModel(EClasseClass, EClass[] allAvailableClasses, Stringname) {
if (!contains(allAvailableClasses, eClass)) {
returnnull;
}
EPackageePackage = eClass.getEPackage();
if (ePackage == null) {
returnnull;
}
EObjectroot = ePackage.getEFactoryInstance().create(eClass);
List<EStructuralFeature> features = eClass.getEAllStructuralFeatures();
for (EStructuralFeaturefeature : features) {
if (featureinstanceofEReference) {
EReferencereference = (EReference) feature;
if (reference.isUnsettable()) {
continue;
}
if (!reference.isChangeable()) {
continue;
}
< rest omitted >
In the highlighted iteration any reference that is unchangeable is prevented from being initialized. However, no attempt is made to prevent initialization of unchangeable attributes. This can be seen in:
} elseif (featureinstanceofEAttribute) {
EAttributeattribute = (EAttribute) feature;
if ("EString".equals(attribute.getEType().getName())) {
StringinitialValue;
if (attribute.getName().equals("name") && name != null) {
initialValue = name;
}
else {
initialValue = "some" + dca.resource.hdca.util.HdcaStringUtil.capitalize(attribute.getName());
}
Objectvalue = root.eGet(attribute);
if (valueinstanceofList<?>) {
List<String> list = dca.resource.hdca.util.HdcaListUtil.castListUnchecked(value);
list.add(initialValue);
} else {
root.eSet(attribute, initialValue);
}
}
}
So probably some additional guarding against initializing unchangeable is due.
The text was updated successfully, but these errors were encountered:
I have created a metamodel having a root that contains a derived, volatile, unchangeable, transient attribute.
Based on that metamodel, a concrete syntax has been defined and the corresponding parser en ui projects have been generated.
Whenever I try to create a new instance using the generated wizard, it fails due to the fact that the wizard tries to set the value of the derived attribute.
Debugging the generated code leads to this section (from the generated MinimalModelHelper):
< rest omitted >
In the highlighted iteration any reference that is unchangeable is prevented from being initialized. However, no attempt is made to prevent initialization of unchangeable attributes. This can be seen in:
So probably some additional guarding against initializing unchangeable is due.
The text was updated successfully, but these errors were encountered: