Community
Participate
Working Groups
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
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