Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Exception in template query
[Acceleo] Exception in template query [message #508809] Wed, 20 January 2010 12:34 Go to next message
Sebastien Roy is currently offline Sebastien Roy
Messages: 51
Registered: November 2009
Member
Hello,

I have the following code :
[for (importValue : String | c.attribute.type.getTypeImport(c).trim())]
import [importValue/];
[/for]	
...

[template public getTypeImport(t : Type, c : Class)]
...
[/template]


That lead to the following exception :

java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchO peration.run(AcceleoLaunchOperation.java:105)
at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginL aunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java: 192)
at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginL aunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java: 109)
at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchD elegate.launch(AcceleoLaunchDelegate.java:52)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:703)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:866)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlu gin.java:1069)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.StackOverflowError
at java.lang.reflect.Method.copy(Method.java:143)
at java.lang.reflect.ReflectAccess.copyMethod(ReflectAccess.jav a:118)
at sun.reflect.ReflectionFactory.copyMethod(ReflectionFactory.j ava:282)
at java.lang.Class.searchMethods(Class.java:2656)
at java.lang.Class.getMethod0(Class.java:2670)
at java.lang.Class.getMethod(Class.java:1603)
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.getJavaMeth odFor(EcoreEvaluationEnvironment.java:151)
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.getJavaMeth odFor(EcoreEvaluationEnvironment.java:1)
at org.eclipse.ocl.AbstractEvaluationEnvironment.callOperation( AbstractEvaluationEnvironment.java:177)
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.callOperati on(EcoreEvaluationEnvironment.java:89)
at org.eclipse.acceleo.engine.internal.environment.AcceleoEvalu ationEnvironment.callOperation(AcceleoEvaluationEnvironment. java:238)
at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.callOperati on(EcoreEvaluationEnvironment.java:1)
at org.eclipse.ocl.EvaluationVisitorImpl.visitOperationCallExp( EvaluationVisitorImpl.java:192)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.j ava:943)
at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(Opera tionCallExpImpl.java:399)
at org.eclipse.ocl.EvaluationVisitorImpl.visitOperationCallExp( EvaluationVisitorImpl.java:161)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.j ava:943)
at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(Opera tionCallExpImpl.java:399)
at org.eclipse.ocl.EvaluationVisitorImpl.visitOperationCallExp( EvaluationVisitorImpl.java:161)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.j ava:943)
at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(Opera tionCallExpImpl.java:399)
at org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(Ab stractEvaluationVisitor.java:246)
at org.eclipse.ocl.EvaluationVisitorDecorator.visitExpression(E valuationVisitorDecorator.java:156)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 376)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitAcceleoIfBlock(AcceleoEvaluationVisitor.jav a:473)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 357)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.ja va:770)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 355)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluation Visitor.java:805)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 366)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua tionVisitor.visitAcceleoIfBlock(AcceleoEvaluationVisitor.jav a:491)
....

The exception is not thrown when the called template has only one argument :

[for (importValue : String | c.attribute.type.getTypeImport().trim())]
import [importValue/];
[/for]	
...

[template public getTypeImport(t : Type)]
...
[/template]



That looks like a bug, doesn't it ?

Sebastien
Re: [Acceleo] Exception in template query [message #508861 is a reply to message #508809] Wed, 20 January 2010 15:01 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1635
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------010901040908060009030909
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Sebastien,

Looks like a bug alright, though I wonder what could possibly trigger
this when the template has two parameters... Could you raise a bugzilla
with the sample model and template?

Laurent Goubet
Obeo

Sebastien Roy wrote:
> Hello,
> I have the following code :
>
> [for (importValue : String | c.attribute.type.getTypeImport(c).trim())]
> import [importValue/];
> [/for]
> ..
>
> [template public getTypeImport(t : Type, c : Class)]
> ..
> [/template]
>
>
> That lead to the following exception :
>
> java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchO
> peration.run(AcceleoLaunchOperation.java:105)
> at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginL
> aunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java: 192)
> at org.eclipse.acceleo.ide.ui.launching.strategy.AcceleoPluginL
> aunchingStrategy.launch(AcceleoPluginLaunchingStrategy.java: 109)
> at org.eclipse.acceleo.internal.ide.ui.launching.AcceleoLaunchD
> elegate.launch(AcceleoLaunchDelegate.java:52)
> at org.eclipse.debug.internal.core.LaunchConfiguration.launch(L
> aunchConfiguration.java:853)
> at org.eclipse.debug.internal.core.LaunchConfiguration.launch(L
> aunchConfiguration.java:703)
> at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D
> ebugUIPlugin.java:866)
> at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlu
> gin.java:1069)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
> Caused by: java.lang.StackOverflowError
> at java.lang.reflect.Method.copy(Method.java:143)
> at java.lang.reflect.ReflectAccess.copyMethod(ReflectAccess.jav a:118)
> at sun.reflect.ReflectionFactory.copyMethod(ReflectionFactory.j ava:282)
> at java.lang.Class.searchMethods(Class.java:2656)
> at java.lang.Class.getMethod0(Class.java:2670)
> at java.lang.Class.getMethod(Class.java:1603)
> at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.getJavaMeth
> odFor(EcoreEvaluationEnvironment.java:151)
> at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.getJavaMeth
> odFor(EcoreEvaluationEnvironment.java:1)
> at org.eclipse.ocl.AbstractEvaluationEnvironment.callOperation(
> AbstractEvaluationEnvironment.java:177)
> at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.callOperati
> on(EcoreEvaluationEnvironment.java:89)
> at org.eclipse.acceleo.engine.internal.environment.AcceleoEvalu
> ationEnvironment.callOperation(AcceleoEvaluationEnvironment. java:238)
> at org.eclipse.ocl.ecore.EcoreEvaluationEnvironment.callOperati
> on(EcoreEvaluationEnvironment.java:1)
> at org.eclipse.ocl.EvaluationVisitorImpl.visitOperationCallExp(
> EvaluationVisitorImpl.java:192)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.j ava:943)
> at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(Opera
> tionCallExpImpl.java:399)
> at org.eclipse.ocl.EvaluationVisitorImpl.visitOperationCallExp(
> EvaluationVisitorImpl.java:161)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.j ava:943)
> at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(Opera
> tionCallExpImpl.java:399)
> at org.eclipse.ocl.EvaluationVisitorImpl.visitOperationCallExp(
> EvaluationVisitorImpl.java:161)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitOperationCallExp(AcceleoEvaluationVisitor.j ava:943)
> at org.eclipse.ocl.ecore.impl.OperationCallExpImpl.accept(Opera
> tionCallExpImpl.java:399)
> at org.eclipse.ocl.AbstractEvaluationVisitor.visitExpression(Ab
> stractEvaluationVisitor.java:246)
> at org.eclipse.ocl.EvaluationVisitorDecorator.visitExpression(E
> valuationVisitorDecorator.java:156)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 376)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitAcceleoIfBlock(AcceleoEvaluationVisitor.jav a:473)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 357)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitAcceleoTemplate(AcceleoEvaluationVisitor.ja va:770)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 355)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitAcceleoTemplateInvocation(AcceleoEvaluation
> Visitor.java:805)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.switchExpression(AcceleoEvaluationVisitor.java:1 366)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitExpression(AcceleoEvaluationVisitor.java:87 2)
> at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvalua
> tionVisitor.visitAcceleoIfBlock(AcceleoEvaluationVisitor.jav a:491)
> ...
>
> The exception is not thrown when the called template has only one
> argument :
>
>
> [for (importValue : String | c.attribute.type.getTypeImport().trim())]
> import [importValue/];
> [/for]
> ..
>
> [template public getTypeImport(t : Type)]
> ..
> [/template]
>
>
>
> That looks like a bug, doesn't it ?
>
> Sebastien
>


--------------010901040908060009030909
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------010901040908060009030909--
Re: [Acceleo] Exception in template query [message #508898 is a reply to message #508809] Wed, 20 January 2010 16:23 Go to previous messageGo to next message
Sebastien Roy is currently offline Sebastien Roy
Messages: 51
Registered: November 2009
Member
Well, the bug is not 100% reproducible.

After some changes, in the template content and in the way it is called, i haven't go any error.

The expression
c.attribute.type.MyCalledTemplate(c)
is similar to
c.attribute.type->collect(MyCalledTemplate(self,c))

I will create a test template in order to try to reproduce this problem independently from the rest of my code.

regards

[Updated on: Wed, 20 January 2010 17:36]

Report message to a moderator

Re: [Acceleo] Exception in template query [message #509052 is a reply to message #508898] Thu, 21 January 2010 09:51 Go to previous messageGo to next message
Sebastien Roy is currently offline Sebastien Roy
Messages: 51
Registered: November 2009
Member
I'm sorry, but I didn't succeeded in reproducing the bug in a simple test example.
It should be linked to the specific model and code context I had at this time.

Sorry

Sebastien
Re: [Acceleo] Exception in template query [message #509081 is a reply to message #509052] Thu, 21 January 2010 10:58 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1635
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040201060802090907070705
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Sebastien,

I tend to dislike bugs that come up randomly ... I hope we'll find a
sure-fire way to trigger this in order to fix the underlying issue.

For now, glad that it works as expected.

Laurent Goubet
Obeo

Sebastien Roy wrote:
> I'm sorry, but I didn't succeeded in reproducing the bug in a simple
> test example.
> It should be linked to the specific model and code context I had at
> this time.
>
> Sorry
>
> Sebastien


--------------040201060802090907070705
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------040201060802090907070705--
Previous Topic:[Xpand] TypeProposalComputer.computeProposals()
Next Topic:[Xpand] Long namespaces and editor proposals
Goto Forum:
  


Current Time: Fri Oct 31 17:28:28 GMT 2014

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

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