Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [acceleo 3] OclInvalid_Class while trying to read an attribute in the model
[acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #730915] Thu, 29 September 2011 14:21 Go to next message
saadia dhouib is currently offline saadia dhouibFriend
Messages: 36
Registered: April 2010
Member
Hi all,

I'm writing my first acceleo generator.
I want to read the values of an attribute which is a List:


[module generate('http://www.eclipse.org/Papyrus/Table/0.8.0/papyrustableinstance','http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8')]

[template public getTableLocalCustomizations(aPapyrusTableInstance : PapyrusTableInstance)]
[file ('stdout', false)][table+'\n'/][/file]
[file ('stdout', false)][table.localCustomizations+'\n'/][/file]
[/template]

It seems that Acceleo does not load the localcustomizations attribute contents (localCustomizations : MetamodelView [1..*]).
The result of the print in the console is as follows:

org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.impl.TableInstance2Impl@14e6393 (parameter: null, hideEmptyColumns: false, onlyShowCommonColumns: false, description: Table Description)
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1b4a6c2 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@130129c (name: OclInvalid_Class) (instanceClassName: null) (abstract: false, interface: false))


Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #730934 is a reply to message #730915] Thu, 29 September 2011 14:58 Go to previous messageGo to next message
saadia dhouib is currently offline saadia dhouibFriend
Messages: 36
Registered: April 2010
Member
When I do a loop (the collection to iterate is table.localCustomizations)

[for (it : MetamodelView | table.localCustomizations)]

['Customization'+aPapyrusTableInstance.table.localCustomizations->indexOf(it)+'.uiCustom'/]"/>

[/for]

I have this acceleo error:
java.lang.IllegalArgumentException
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:258)
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:1)
at org.eclipse.ocl.EvaluationVisitorImpl.visitPropertyCallExp(EvaluationVisitorImpl.java:2088)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitPropertyCallExp(AcceleoEvaluationVisitor.java:1111)
at org.eclipse.ocl.ecore.impl.PropertyCallExpImpl.accept(PropertyCallExpImpl.java:238)
at org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(AbstractEvaluationVisitor.java:248)
at org.eclipse.ocl.EvaluationVisitorDecorator.visitExpression(EvaluationVisitorDecorator.java:156)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1693)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:413)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1656)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoFileBlock(AcceleoEvaluationVisitor.java:396)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1663)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:867)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1643)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:152)
at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:62)
at org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:265)
at org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:130)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:860)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:523)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:175)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:154)
at org.eclipse.papyrus.table.generation.acceleo.main.Generate.doGenerate(Generate.java:220)
at org.eclipse.papyrus.table.generation.handlers.TableJavaCodeGenerator.runAcceleoTransformation(TableJavaCodeGenerator.java:87)
at org.eclipse.papyrus.table.generation.handlers.GenerateTableHandler$1.doExecuteWithResult(GenerateTableHandler.java:141)
at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.papyrus.core.utils.GMFtoEMFCommandWrapper.execute(GMFtoEMFCommandWrapper.java:87)
at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:267)
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:150)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

!ENTRY org.eclipse.acceleo.engine 2 2 2011-09-29 16:25:05.382
!MESSAGE Invalid loop iteration at line 221 in Module generate for block for (self.table.localCustomizations). Last recorded value of self was org.eclipse.papyrus.table.instance.papyrustableinstance.impl.PapyrusTableInstanceImpl@1805296 (name: DefaultTable, type: PapyrusDefaultTable, isSynchronized: false).
!STACK 0
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop iteration at line 221 in Module generate for block for (self.table.localCustomizations). Last recorded value of self was org.eclipse.papyrus.table.instance.papyrustableinstance.impl.PapyrusTableInstanceImpl@1805296 (name: DefaultTable, type: PapyrusDefaultTable, isSynchronized: false).
at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:221)
at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:146)
at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:143)
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #730935 is a reply to message #730915] Thu, 29 September 2011 14:56 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

In [file ('stdout', false)][table+'\n'/][/file]

you invoke the 'OCL' operation to compute the string concatenation of
Acceleo's default toString for table and a new lin.

It would be simpler to write

[file ('stdout', false)]table/]
[/file]

In [file ('stdout', false)][table.localCustomizations+'\n'/][/file]

you similarly perform an OCL evaluation of the concatenation of
Acceleo's toString for what is presumably a Collection. I have no idea
what this does, but if at any point something fails you will get
invalid, and probably will get invalid if the Collection is empty too.
The OclInvalid_Class mumbo jumbo is OCL's very klunky way of printing
'invalid'. The new Eclipse OCL pivot implementation has the natural
spelling.

I suggest you use a [for loop to iterate your localCustomizations.

It is very very unlikely that Acceleo has failed to load them, since
that would be a failure in massively widely used EMF code.

Regards

Ed Willink

On 29/09/2011 15:21, saadia dhouib wrote:
> Hi all,
>
> I'm writing my first acceleo generator.
> I want to read the values of an attribute which is a List:
>
>
> [module
> generate('http://www.eclipse.org/Papyrus/Table/0.8.0/papyrustableinstance','http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8')]
>
> [template public getTableLocalCustomizations(aPapyrusTableInstance :
> PapyrusTableInstance)]
> [file ('stdout', false)][table+'\n'/][/file]
> [file ('stdout', false)][table.localCustomizations+'\n'/][/file]
> [/template]
>
> It seems that Acceleo does not load the localcustomizations attribute
> contents (localCustomizations : MetamodelView [1..*]).
> The result of the print in the console is as follows:
>
> mailto:org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.impl.TableInstance2Impl@14e6393
> (parameter: null, hideEmptyColumns: false, onlyShowCommonColumns:
> false, description: Table Description)
> mailto:org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1b4a6c2 (eClass:
> mailto:org.eclipse.emf.ecore.impl.EClassImpl@130129c (name:
> OclInvalid_Class) (instanceClassName: null) (abstract: false,
> interface: false))
>
>
>
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #730958 is a reply to message #730934] Thu, 29 September 2011 15:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It says you are doing a rubbish navigation.

Your loop is wierd. Why not just

[for (it : MetamodelView | table.localCustomizations)]
['Customization'+it+'.uiCustom'/]"/>
[/for]

I suspect that aPapyrusTableInstance is bad but without the line numbers

at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:221)

is unhelpful.

Regards

Ed Willink

On 29/09/2011 15:58, saadia dhouib wrote:
> When I do a loop (the collection to iterate is table.localCustomizations)
>
> [for (it : MetamodelView | table.localCustomizations)]
>
> ['Customization'+aPapyrusTableInstance.table.localCustomizations->indexOf(it)+'.uiCustom'/]"/>
>
> [/for]
>
> I have this acceleo error:
> java.lang.IllegalArgumentException
> at
> org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:258)
> at
> org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:1)
> at
> org.eclipse.ocl.EvaluationVisitorImpl.visitPropertyCallExp(EvaluationVisitorImpl.java:2088)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitPropertyCallExp(AcceleoEvaluationVisitor.java:1111)
> at
> org.eclipse.ocl.ecore.impl.PropertyCallExpImpl.accept(PropertyCallExpImpl.java:238)
> at
> org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(AbstractEvaluationVisitor.java:248)
> at
> org.eclipse.ocl.EvaluationVisitorDecorator.visitExpression(EvaluationVisitorDecorator.java:156)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1693)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:413)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1656)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoFileBlock(AcceleoEvaluationVisitor.java:396)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1663)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:867)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1643)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
> at
> org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:152)
> at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:62)
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:265)
> at
> org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:130)
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:860)
> at
> org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:523)
> at
> org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:175)
> at
> org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:154)
> at
> org.eclipse.papyrus.table.generation.acceleo.main.Generate.doGenerate(Generate.java:220)
> at
> org.eclipse.papyrus.table.generation.handlers.TableJavaCodeGenerator.runAcceleoTransformation(TableJavaCodeGenerator.java:87)
> at
> org.eclipse.papyrus.table.generation.handlers.GenerateTableHandler$1.doExecuteWithResult(GenerateTableHandler.java:141)
> at
> org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
> at
> org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
> at
> org.eclipse.papyrus.core.utils.GMFtoEMFCommandWrapper.execute(GMFtoEMFCommandWrapper.java:87)
> at
> org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:267)
> at
> org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
> at
> org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
> at
> org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
> at
> org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
> at
> org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
> at
> org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
> at
> org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:150)
> at
> org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
> at
> org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
> at
> org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
> at
> org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
> at
> org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
> at
> org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
> at
> org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
> at
> org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
> at
> org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
> at
> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
> at
> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
> at
> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
> at
> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
> at
> org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
> at
> org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
>
> !ENTRY org.eclipse.acceleo.engine 2 2 2011-09-29 16:25:05.382
> !MESSAGE Invalid loop iteration at line 221 in Module generate for
> block for (self.table.localCustomizations). Last recorded value of
> self was
> mailto:org.eclipse.papyrus.table.instance.papyrustableinstance.impl.PapyrusTableInstanceImpl@1805296
> (name: DefaultTable, type: PapyrusDefaultTable, isSynchronized: false).
> !STACK 0
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop
> iteration at line 221 in Module generate for block for
> (self.table.localCustomizations). Last recorded value of self was
> mailto:org.eclipse.papyrus.table.instance.papyrustableinstance.impl.PapyrusTableInstanceImpl@1805296
> (name: DefaultTable, type: PapyrusDefaultTable, isSynchronized: false).
> at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:221)
> at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:146)
> at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:143)
>
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #731161 is a reply to message #730958] Fri, 30 September 2011 07:27 Go to previous messageGo to next message
saadia dhouib is currently offline saadia dhouibFriend
Messages: 36
Registered: April 2010
Member
Hi Edward,
I have changed my loop to print the contents of the localcustomizations list in the console:

line 143 [template public generatePlugin(aPapyrusTableInstance : PapyrusTableInstance)]
[comment @main/]

line 146 [file ('../plugin.xml', false, 'UTF-8')]

line 211 [file ('stdout', false)][table/][/file]
line 212 [for (it : MetamodelView | table.localCustomizations)]
line 213 [file ('stdout', false)][it/]
line 214 [/file]
[/for]

The table is printed in the console, but I have still errors in the loop:
org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.impl.TableInstance2Impl@12c70d2 (parameter: null, hideEmptyColumns: false, onlyShowCommonColumns: false, description: Table Description)
!ENTRY org.eclipse.ocl 4 10 2011-09-30 09:18:21.025
!MESSAGE Evaluation failed with an exception: (no message)
!STACK 0
java.lang.IllegalArgumentException
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:258)
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.navigateProperty(EcoreEvaluationEnvironment.java:1)
at org.eclipse.ocl.EvaluationVisitorImpl.visitPropertyCallExp(EvaluationVisitorImpl.java:2088)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitPropertyCallExp(AcceleoEvaluationVisitor.java:1111)
at org.eclipse.ocl.ecore.impl.PropertyCallExpImpl.accept(PropertyCallExpImpl.java:238)
at org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(AbstractEvaluationVisitor.java:248)
at org.eclipse.ocl.EvaluationVisitorDecorator.visitExpression(EvaluationVisitorDecorator.java:156)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1693)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoForBlock(AcceleoEvaluationVisitor.java:413)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1656)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoFileBlock(AcceleoEvaluationVisitor.java:396)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1663)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.java:867)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1643)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:999)
at org.eclipse.ocl.internal.evaluation.QueryImpl.evaluate(QueryImpl.java:152)
at org.eclipse.ocl.ecore.QueryImpl.evaluate(QueryImpl.java:62)
at org.eclipse.acceleo.engine.generation.AcceleoEngine.doEvaluate(AcceleoEngine.java:265)
at org.eclipse.acceleo.engine.generation.AcceleoEngine.evaluate(AcceleoEngine.java:130)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerateTemplate(AcceleoService.java:860)
at org.eclipse.acceleo.engine.service.AcceleoService.doGenerate(AcceleoService.java:523)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.generate(AbstractAcceleoGenerator.java:175)
at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.doGenerate(AbstractAcceleoGenerator.java:154)
at org.eclipse.papyrus.table.generation.acceleo.main.Generate.doGenerate(Generate.java:220)
at org.eclipse.papyrus.table.generation.handlers.TableJavaCodeGenerator.runAcceleoTransformation(TableJavaCodeGenerator.java:87)
at org.eclipse.papyrus.table.generation.handlers.GenerateTableHandler$1.doExecuteWithResult(GenerateTableHandler.java:141)
at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:247)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.papyrus.core.utils.GMFtoEMFCommandWrapper.execute(GMFtoEMFCommandWrapper.java:87)
at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:267)
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:219)
at org.eclipse.papyrus.modelexplorer.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:150)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)

!ENTRY org.eclipse.acceleo.engine 2 2 2011-09-30 09:18:21.181
!MESSAGE Invalid loop iteration at line 212 in Module generate for block for (self.table.localCustomizations). Last recorded value of self was org.eclipse.papyrus.table.instance.papyrustableinstance.impl.PapyrusTableInstanceImpl@a934ec (name: DefaultTable, type: PapyrusDefaultTable, isSynchronized: false).
!STACK 0
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid loop iteration at line 212 in Module generate for block for (self.table.localCustomizations). Last recorded value of self was org.eclipse.papyrus.table.instance.papyrustableinstance.impl.PapyrusTableInstanceImpl@a934ec (name: DefaultTable, type: PapyrusDefaultTable, isSynchronized: false).
at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:212)
at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:146)
at generate.generatePlugin(PapyrusTableInstance)(generate.mtl:143)
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #731163 is a reply to message #730958] Fri, 30 September 2011 07:30 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

Quote:

In [file ('stdout', false)][table+'\n'/][/file]

you invoke the 'OCL' operation to compute the string concatenation of
Acceleo's default toString for table and a new lin.


and that is supported, though indeed not the most readable way of doing it.

[Sequence{'a', 'b'} + 'c'/]

does output "abc". Moreover,
[null + 'c'/]

properly outputs "c"...

However, that is with the latest versions of Acceleo. I suspect that you are using one of the versions where we did not (or _could_ not) override OCL's "plus" operation. Which version of Acceleo are you using, under which version of Eclipse?

Laurent Goubet
Obeo
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #731188 is a reply to message #731163] Fri, 30 September 2011 08:17 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Okay, so what fails here is that "localCustomizations" cannot be found. Acceleo (and, transitively, OCL) managed to compile your module properly; which means that at compile time, that eStructuralFeature was found. Yet at runtime, OCL does not manage to find it. This issue is most likely due to OCL not interacting well with EMF Facet.

Ed, the code of EcoreEvaluationEnvironment fails because of the line (or at least I think that this line is the culprit) :
if (etarget.eClass().getEAllStructuralFeatures().contains(property)) {


Why would the compilation work and not the evaluation?

Laurent Goubet
Obeo
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #731210 is a reply to message #731188] Fri, 30 September 2011 09:27 Go to previous messageGo to next message
saadia dhouib is currently offline saadia dhouibFriend
Messages: 36
Registered: April 2010
Member
Hi Laurent,
I'm using:
Eclipse Indigo 3.7.0
Acceleo SDK 3.1.0.v20110607-0602 org.eclipse.acceleo.sdk.feature.group Eclipse Modeling Project
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #731218 is a reply to message #731188] Fri, 30 September 2011 09:55 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

It could either be that

line 244: if (target instanceof EObject) fails, i.e target is not an
EObject. Maybe the model does not extend EObject. Maybe a bad navigation
has traversed a Collection or a Tuple or unresolved proxy.

line 247: if
(etarget.eClass().getEAllStructuralFeatures().contains(property)) fails,
i.e. eTarget does not have the required feature; - out of date generated
Java compared to the *.ecore used by the editor/compiler. Or property is
a 'different' property because of our old friend meta-model schizophrenia.

Since navigation to table has succeeded, out of data Java is most
likely, but unwise cross-resource containment with unresolved proxies
might cause any amount of confusing chaos.

Difficult to conclude more than that table.localCustomizations is bad
without single stepping to examine the navigation as it fails.

However regenerating the Java has to be worth a try.

Regards

Ed Willink


On 30/09/2011 09:17, Laurent Goubet wrote:
> Okay, so what fails here is that "localCustomizations" cannot be
> found. Acceleo (and, transitively, OCL) managed to compile your module
> properly; which means that at compile time, that eStructuralFeature
> was found. Yet at runtime, OCL does not manage to find it. This issue
> is most likely due to OCL not interacting well with EMF Facet.
>
> Ed, the code of EcoreEvaluationEnvironment fails because of the line
> (or at least I think that this line is the culprit) :
> if (etarget.eClass().getEAllStructuralFeatures().contains(property)) {
>
> Why would the compilation work and not the evaluation?
>
> Laurent Goubet
> Obeo
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #731254 is a reply to message #731218] Fri, 30 September 2011 11:54 Go to previous messageGo to next message
saadia dhouib is currently offline saadia dhouibFriend
Messages: 36
Registered: April 2010
Member
Does the problem come from acceleo or from the used metamodel ?

I can read the contents of the localcustomizations List using java:

if(customizations != null && !customizations.isEmpty()) {
customFiles = new ArrayList<String>();

for(Iterator<MetamodelView> it = customizations.iterator(); it.hasNext()Wink {
MetamodelView custom = it.next();

System.err.println(custom);

addCustomizationFile(pluginID, uiCustomRelativePath, custom);


}
}
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #733610 is a reply to message #731254] Wed, 05 October 2011 08:17 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Hi,

I can't say for sure where the problem is stemming from. It could be Acceleo, it could be the metamodel ... my guess though is that the issue here is a little more complex, and that we (Acceleo or OCL) are missing something when using EMF Facet-enhanced metamodels. Could you raise a bug against M2T/Acceleo in order to track this issue? We'll have to test the integration between Acceleo and EMF Facet in depth in order to verify this.

Laurent Goubet
Obeo
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #733645 is a reply to message #733610] Wed, 05 October 2011 09:27 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

On 30/09/2011 10:55, Ed Willink wrote:
> However regenerating the Java has to be worth a try.
>
Have you done this?

On 05/10/2011 09:17, Laurent Goubet wrote:
> I can't say for sure where the problem is stemming from. It could be
> Acceleo, it could be the metamodel ... my guess though is that the
> issue here is a little more complex, and that we (Acceleo or OCL) are
> missing something when using EMF Facet-enhanced metamodels. Could you
> raise a
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2T&component=Acceleo
> in order to track this issue? We'll have to test the integration
> between Acceleo and EMF Facet in depth in order to verify this.
Where does EMF Facet come in to this problem? I missed it in the problem
report.

If EMF Facet is modifying meta-models in memory:

I wonder whether EMF is correctly refreshing all cached content.

I doubt that OCL (and consequently Acceleo) is seeing a consistent
meta-model description.

I doubt that Acceleo is seeing the same meta-model in each of its
edit/build/execute phases.

I doubt that the user has provided the facetted meta-model to the tools
correctly.

If augmented meta-models are required in an evaluation context, it is
probably necessary for the augment to be presented as a Complete OCL
document and you probably need the evolving capabilities of the pivot
model to support it. The OMG OCL specification does not indicate how an
OCL AST can evaluate with referredProperty or referredOperation elements
whose targets are not part of any meta-model. The current
Ecore/UML-based OCL implementation uses non-modelled
additionalAttributes and additionalOperations that work while the model
is in memory. Since Acceleo uses OCL to persist these references in its
EMTL, file they cannot possibly work once reloaded for execution. The
new pivot model OCL implementation prototypes a possible OCL 2.4
resolution of the problem in which the complements are modelled and so
can be referenced. EMF facets augments could therefore be represented
either in Concrete Syntax form as a Complete OCL document, or in
Abstract Syntax form as a pivot Package or EPackage with contents to be
merged into any other same-nsURI Package/EPackage.

Regards

Ed Willink
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #733967 is a reply to message #733645] Thu, 06 October 2011 07:18 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
Ed,

Quote:

Where does EMF Facet come in to this problem? I missed it in the problem report.


Quite often I see you jumping on "metamodel schizophrenia". It is indeed a cause for concerns ... but not all. The poster here uses a model enhanced with EMF Facet, which can be seen plainly by reading his example module and stack trace. He uses metamodels :

[module generate('http://www.eclipse.org/Papyrus/Table/0.8.0/papyrustableinstance','http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8')]

and the "table" object on which he tries to retrieve a property value is an instance of org.eclipse.emf.facet.widgets.nattable.instance.tableinstance2.impl.TableInstance2Impl@14e6393. I am pretty sure the "localCustomizations" property which value he tries to retrieve through Acceleo is one defined through a facet augment; and that would explain why he raises an issue we have never faced. Before trying to give a convoluted answer, the one thing we have to do is to test on our side whether this is a use case we can handle, and if so, how. Only then will we be able to properly answer the question.

Laurent Goubet
Obeo
Re: [acceleo 3] OclInvalid_Class while trying to read an attribute in the model [message #733999 is a reply to message #733967] Thu, 06 October 2011 09:28 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
And yet ... I apologize Ed, there is a good possibility that you are right and that this _is_ a case of metamodel schizophrenia... Looking at how papyrus metamodels and customizations through facets are defined, I fear that the URIs are not right.

Saadia, could you provide us with the models you are using for this generation? I did not manage to create a useable sample of my own through papyrus.

Laurent Goubet
Obeo
Previous Topic:[acceleo] @main & invoking generated Java class
Next Topic:[Acceleo 3.1] Template overrides
Goto Forum:
  


Current Time: Thu Mar 28 11:49:22 GMT 2024

Powered by FUDForum. Page generated in 0.03353 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top