Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [Xtend] Assign value to Array of EInt
[Xtend] Assign value to Array of EInt [message #530035] Wed, 28 April 2010 09:09 Go to next message
Ludwig Straub is currently offline Ludwig StraubFriend
Messages: 14
Registered: July 2009
Junior Member
Hello,

I came across the following situation:

Let's say I have a metamodel class with two attributes:
ei: EInt [0..1]
eia: EInt [0..N]


The following works in Xtend when filling an instance of that class:
setEi(42)


The following does not work in Xtend but results in an java.lang.ArrayStoreException:
eia.add(42)


Stacktrace:
3156 ERROR AbstractExpressionsUsingWorkflowComponent - java.lang.ArrayStoreException
java.lang.ArrayStoreException
	at org.eclipse.emf.common.util.BasicEList.assign(BasicEList.java:124)
	at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:424)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddUnique(NotifyingListImpl.java:331)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:315)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
	at org.eclipse.internal.xtend.type.baseimpl.types.CollectionTypeImpl$6.evaluateInternal(CollectionTypeImpl.java:184)
	at org.eclipse.internal.xtend.type.baseimpl.OperationImpl.evaluate(OperationImpl.java:36)
	at org.eclipse.internal.xtend.expression.ast.OperationCall.evaluate(OperationCall.java:342)
	at org.eclipse.internal.xtend.expression.ast.OperationCall.evaluateInternal(OperationCall.java:95)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:50)
	at org.eclipse.internal.xtend.expression.ast.ChainExpression.evaluateInternal(ChainExpression.java:38)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:50)
	at org.eclipse.internal.xtend.expression.ast.ChainExpression.evaluateInternal(ChainExpression.java:38)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:50)
	at org.eclipse.internal.xtend.expression.ast.LetExpression.evaluateInternal(LetExpression.java:57)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:50)
	at org.eclipse.internal.xtend.xtend.ast.ExpressionExtensionStatement.evaluateInternal2(ExpressionExtensionStatement.java:58)
	at org.eclipse.internal.xtend.xtend.ast.ExpressionExtensionStatement.evaluateInternal(ExpressionExtensionStatement.java:47)
	at org.eclipse.internal.xtend.xtend.ast.AbstractExtension.evaluate(AbstractExtension.java:166)
	at org.eclipse.internal.xtend.expression.ast.OperationCall.evaluate(OperationCall.java:335)
	at org.eclipse.internal.xtend.expression.ast.OperationCall.evaluateInternal(OperationCall.java:76)
	at org.eclipse.internal.xtend.expression.ast.Expression.evaluate(Expression.java:50)
	at org.eclipse.xtend.expression.ExpressionFacade.evaluate(ExpressionFacade.java:56)
	at org.eclipse.xtend.expression.ExpressionFacade.evaluate(ExpressionFacade.java:45)
	at org.eclipse.xtend.XtendComponent.invokeInternal2(XtendComponent.java:190)
	at org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflowComponent.invokeInternal(AbstractExpressionsUsingWorkflowComponent.java:238)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:129)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:101)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:86)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:101)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:86)
	at org.eclipse.emf.mwe.core.container.ConditionalComponent.internalInvoke(ConditionalComponent.java:57)
	at org.eclipse.emf.mwe.core.container.ConditionalComponent.invoke(ConditionalComponent.java:39)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:101)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:86)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.internalInvoke(CompositeComponent.java:101)
	at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke(CompositeComponent.java:86)
	at org.eclipse.emf.mwe.core.WorkflowRunner.executeWorkflow(WorkflowRunner.java:408)
	at org.eclipse.emf.mwe.core.WorkflowRunner.run(WorkflowRunner.java:293)
	at org.eclipse.emf.mwe.core.WorkflowRunner.main(WorkflowRunner.java:241)


My question:
Why does it crash?

Kind regards
Ludwig
Re: [Xtend] Assign value to Array of EInt [message #530497 is a reply to message #530035] Thu, 29 April 2010 18:51 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Ludwig,

that's propably a bug. Please file a ticket.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 28.04.10 11:09, schrieb Ludwig Straub:
> Hello,
>
> I came across the following situation:
>
> Let's say I have a metamodel class with two attributes:
>
> ei: EInt [0..1]
> eia: EInt [0..N]
>
>
> The following works in Xtend when filling an instance of that class:
>
> setEi(42)
>
>
> The following does not work in Xtend but results in an
> java.lang.ArrayStoreException:
>
> eia.add(42)
>
>
> Stacktrace:
>
> 3156 ERROR AbstractExpressionsUsingWorkflowComponent -
> java.lang.ArrayStoreException
> java.lang.ArrayStoreException
> at org.eclipse.emf.common.util.BasicEList.assign(BasicEList.jav a:124)
> at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList. java:424)
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.doAddUn ique(NotifyingListImpl.java:331)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:315)
>
> at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList. java:307)
> at
> org.eclipse.internal.xtend.type.baseimpl.types.CollectionTyp eImpl$6.evaluateInternal(CollectionTypeImpl.java:184)
>
> at
> org.eclipse.internal.xtend.type.baseimpl.OperationImpl.evalu ate(OperationImpl.java:36)
>
> at
> org.eclipse.internal.xtend.expression.ast.OperationCall.eval uate(OperationCall.java:342)
>
> at
> org.eclipse.internal.xtend.expression.ast.OperationCall.eval uateInternal(OperationCall.java:95)
>
> at
> org.eclipse.internal.xtend.expression.ast.Expression.evaluat e(Expression.java:50)
>
> at
> org.eclipse.internal.xtend.expression.ast.ChainExpression.ev aluateInternal(ChainExpression.java:38)
>
> at
> org.eclipse.internal.xtend.expression.ast.Expression.evaluat e(Expression.java:50)
>
> at
> org.eclipse.internal.xtend.expression.ast.ChainExpression.ev aluateInternal(ChainExpression.java:38)
>
> at
> org.eclipse.internal.xtend.expression.ast.Expression.evaluat e(Expression.java:50)
>
> at
> org.eclipse.internal.xtend.expression.ast.LetExpression.eval uateInternal(LetExpression.java:57)
>
> at
> org.eclipse.internal.xtend.expression.ast.Expression.evaluat e(Expression.java:50)
>
> at
> org.eclipse.internal.xtend.xtend.ast.ExpressionExtensionStat ement.evaluateInternal2(ExpressionExtensionStatement.java:58 )
>
> at
> org.eclipse.internal.xtend.xtend.ast.ExpressionExtensionStat ement.evaluateInternal(ExpressionExtensionStatement.java:47)
>
> at
> org.eclipse.internal.xtend.xtend.ast.AbstractExtension.evalu ate(AbstractExtension.java:166)
>
> at
> org.eclipse.internal.xtend.expression.ast.OperationCall.eval uate(OperationCall.java:335)
>
> at
> org.eclipse.internal.xtend.expression.ast.OperationCall.eval uateInternal(OperationCall.java:76)
>
> at
> org.eclipse.internal.xtend.expression.ast.Expression.evaluat e(Expression.java:50)
>
> at
> org.eclipse.xtend.expression.ExpressionFacade.evaluate(Expre ssionFacade.java:56)
>
> at
> org.eclipse.xtend.expression.ExpressionFacade.evaluate(Expre ssionFacade.java:45)
>
> at
> org.eclipse.xtend.XtendComponent.invokeInternal2(XtendCompon ent.java:190)
> at
> org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent.invokeInternal(AbstractExpressionsUsingWorkflowCo mponent.java:238)
>
> at
> org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invok e(AbstractWorkflowComponent.java:129)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.intern alInvoke(CompositeComponent.java:101)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.invoke (CompositeComponent.java:86)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.intern alInvoke(CompositeComponent.java:101)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.invoke (CompositeComponent.java:86)
>
> at
> org.eclipse.emf.mwe.core.container.ConditionalComponent.inte rnalInvoke(ConditionalComponent.java:57)
>
> at
> org.eclipse.emf.mwe.core.container.ConditionalComponent.invo ke(ConditionalComponent.java:39)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.intern alInvoke(CompositeComponent.java:101)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.invoke (CompositeComponent.java:86)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.intern alInvoke(CompositeComponent.java:101)
>
> at
> org.eclipse.emf.mwe.core.container.CompositeComponent.invoke (CompositeComponent.java:86)
>
> at
> org.eclipse.emf.mwe.core.WorkflowRunner.executeWorkflow(Work flowRunner.java:408)
>
> at org.eclipse.emf.mwe.core.WorkflowRunner.run(WorkflowRunner.j ava:293)
> at org.eclipse.emf.mwe.core.WorkflowRunner.main(WorkflowRunner. java:241)
>
>
> My question:
> Why does it crash?
>
> Kind regards
> Ludwig
Re: [Xtend] Assign value to Array of EInt [message #531327 is a reply to message #530035] Tue, 04 May 2010 14:38 Go to previous message
Ludwig Straub is currently offline Ludwig StraubFriend
Messages: 14
Registered: July 2009
Junior Member
Done.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=311539
Previous Topic:[ATL] references
Next Topic:ATL and References in XMI files
Goto Forum:
  


Current Time: Fri Dec 13 11:49:18 GMT 2024

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

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

Back to the top