| Summary: | ElementInitializer.xpt and Sequence{IntegerValue} | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] GMF-Tooling | Reporter: | Ralph Gerbig <ralphgerbig> | ||||
| Component: | Core | Assignee: | Ralph Gerbig <ralphgerbig> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | critical | ||||||
| Priority: | P3 | CC: | mistria | ||||
| Version: | unspecified | Flags: | mistria:
review+
|
||||
| Target Milestone: | 2.4 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Do you think you could provide a patch for this bug? (In reply to comment #1) > Do you think you could provide a patch for this bug? I do have this line running perfectly: «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».add((«EXPAND MetaModel::QualifiedClassName /*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/FOR getTypeGenClassifier(feature)») next); I copyied the type cast from some lines beneath. It works with string, boolean and integer lists for me. Still in 2.4.0. Can you please provide your suggested modification as a patch (checkout the org.eclipse,gmf.codegen, apply your modification, and then use Team>Create Patch) ? Created attachment 199087 [details]
Patch
Patch seems clean enough. I've run tests with the patch and they are still green. I committed your patch, and it will be available in 2.4.0. You can get an interim unofficial experimental build here: https://hudson.eclipse.org/hudson/job/tycho-gmp.gmf.tooling/ Thanks a lot Ralph. version -> 2.4 Rollback, Set target to 2.4 instead of accidenatlly set Version Comment on attachment 199087 [details]
Patch
to be included into IP log
|
Build Identifier: 20100917-0705 Hi, i have the a OCL Expression (Sequence{0,0}) to initialize a EInt[2..*] EMF List. For this not compilable code is generated. The following lines of ElementInitializer are responsible for this: ---------------------------------------------------------------------------- «IF getTypeGenClassifier(feature).expressionResultNeedsCast()-» for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) { Object next = «diagramElement.getDiagram().editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()».performCast(it.next(), «EXPAND MetaModel::MetaClass FOR getTypeGenClassifier(feature)»); «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».add(next); } «ELSE-» ------------------------------------------------------------------------------- - getTypeGenClassifier(feature).expressionResultNeedsCast() recognizes that my Integers need a type cast as they are numeric values. - Object next = «diagramElement.getDiagram() ... does produce an Object, but for the code to work I need an Integer. - I need to change «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».add(next); to «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».add((Integer)next); by hand to work. Reproducible: Always