Community
Participate
Working Groups
This Xtend code produces uncompilable code: ============================================= for (e : model.entities) { val p = model.configuration.classes.findFirst(c|c.entityName==e.name) e.persistentClass = p } ============================================= "e" is in this case not final, but used within a function: "Cannot refer to a non-final variable e inside an inner class defined in a different method" ============================================= for (Entity e : _entities) { { Configuration _configuration = this.model.getConfiguration(); EList<PersistentClass> _classes = _configuration.getClasses(); final Function1<PersistentClass,Boolean> _function = new Function1<PersistentClass,Boolean>() { public Boolean apply(final PersistentClass c) { String _entityName = c.getEntityName(); String _name = e.getName(); <== *** ERROR boolean _operator_equals = ObjectExtensions.operator_equals(_entityName, _name); return ((Boolean)_operator_equals); } }; PersistentClass _findFirst = IterableExtensions.<PersistentClass>findFirst(_classes, _function); final PersistentClass p = _findFirst; e.setPersistentClass(p); } } ============================================= Workaround: Create a val for the loop variable: ============================================= for (e : model.entities) { val e1 = e val p = model.configuration.classes.findFirst(c|c.entityName==e1.name) e1.persistentClass = p } ============================================= Maybe the loop's variable should be compiled as final?
This one was already fixed for SR1
Closing all bugs that were set to RESOLVED before Neon.0