| Summary: | FactoryClass.javajet generates invalid FactoryImpl | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Henning Heitkoetter <hheitkoetter> | ||||||
| Component: | Tools | Assignee: | Dave Steinberg <davidms> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | Ed.Merks, mirko | ||||||
| Version: | 2.6.0 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 320433 | ||||||||
| Attachments: |
|
||||||||
|
Description
Henning Heitkoetter
I actually just ran into exactly this problem. The FactoryImpl for the generated model contained three broken methods:
...
public List<String> createReferenceListTypeFromString(EDataType eDataType, String initialValue)
{
if (initialValue == null) return null;
List<String> result = new ArrayList<String>();
for (String item : split(literal))
{
result.add((String)XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.Literals.ANY_URI, item));
}
return result;
}
public List<String> createRelatedFieldsTypeFromString(EDataType eDataType, String initialValue)
{
if (initialValue == null) return null;
List<String> result = new ArrayList<String>();
for (String item : split(literal))
{
result.add((String)XMLTypeFactory.eINSTANCE.createFromString(XMLTypePackage.Literals.STRING, item));
}
return result;
}
public List<String> createValueListTypeFromString(EDataType eDataType, String initialValue)
{
if (initialValue == null) return null;
List<String> result = new ArrayList<String>();
for (String item : split(literal))
{
result.add(createValueListTypeItemFromString(FilingPackage.Literals.VALUE_LIST_TYPE_ITEM, item));
}
return result;
}
...
Unfortunately, the ECore file and the original XSD from which the model was generated are proprietary information, and I can't post them here. Let me know if there is anything else I can provide to help debugging this issue.
Also, I'm interested in a work-around, because now I always have to manually fix up the generated model classes.
(In reply to comment #1) > Also, I'm interested in a work-around, because now I always have to manually > fix up the generated model classes. You can take the old template from http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.emf/org.eclipse.emf/plugins/org.eclipse.emf.codegen.ecore/templates/model/FactoryClass.javajet?revision=1.34&root=Modeling_Project&view=markup and store it (for example) in a folder "templates/model". In your genmodel, look at the properties of the Templates&Merge category. Set "Dynamic Templates" to true and set "Template Directory" to point to the path where the model folder is stored (e.g. your_project_name/templates). Created attachment 174769 [details]
Patches to address the issue.
The split method should have been added to EFactoryImpl just as it was for GWT's version of EFactoryImpl and of course we should be referring to initialValue not literal in the case pointed out.
Created attachment 174777 [details]
The changes need for the 2.6 maintenance stream.
The changes are committed to CVS for 2.6.1. The fix is available in the latest build for the stream. |