Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Using helper as attribute/variable brings exception
Using helper as attribute/variable brings exception [message #1062004] Wed, 05 June 2013 11:23 Go to next message
Javier García is currently offline Javier GarcíaFriend
Messages: 129
Registered: April 2013
Senior Member
I've got a problem with a helper, the code is as follows:
helper def : transformedIRealizations : Sequence(UML2!InterfaceRealization) = UML2!InterfaceRealization.allInstancesFrom('IN')->debug('First step: ')->select(e|e.owner.isStereotyped())->debug('Second step:');

And when I run the transformation I get the following output, including an exception:
First step: : OrderedSet {IN!<unnamed>, IN!<unnamed>,..., IN!<unnamed>}
org.eclipse.m2m.atl.engine.emfvm.VMException: 1
	at main#33(UMLCopy.atl)
		local variables: 
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException: 1
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(
	at org.eclipse.m2m.atl.core.service.LauncherService.launch(
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(
	at org.eclipse.debug.internal.ui.DebugUIPlugin$
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(
	... 11 more

So as you can see, using the debugging function only the first step is shown, while the second step I assume is the one causing the exception.
I tried executing this code outside of this helper and it works just fine, but I wanted to include this in this helper so that I wouldn't have to run the same thing a thousand times, since my transformation was taking too long to run, and now if I do it like this it just doesnt work.

I'll add some more related code here in case it might help, let me know if there's something else you might need to know:
The header of the file:
-- @nsURI UML2=
-- @nsURI XML=
-- @nsURI profile=
module SuperimposedStereotyping;
create OUT: UML2 from IN: UML2, Plugin: XML, Profile: profile;
helper context UML2!Class def: isStereotyped(): Boolean =
	self.isInPlugin('view') or self.isInPlugin('perspective') or self.isInPlugin('actionTool') or self.isInPlugin('modalTool');

helper context UML2!Class def: isInPlugin(name: String): Boolean =
			(XML!Attribute.allInstancesFrom('Plugin') -> select(e | e.value.endsWith(
			and = name).notEmpty());

Also note that this is a superimposed module that gets called from the main module (UMLCopy.atl)

So what could be the cause?

Thanks in advance,

[Updated on: Wed, 05 June 2013 11:56]

Report message to a moderator

Re: Using helper as attribute/variable brings exception [message #1062027 is a reply to message #1062004] Wed, 05 June 2013 13:31 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 552
Registered: July 2009
Senior Member
Yep I think the helper needs at least to be declared in the main module even if it's overriden by a superimposed module.
Re: Using helper as attribute/variable brings exception [message #1062134 is a reply to message #1062027] Thu, 06 June 2013 07:49 Go to previous message
Javier García is currently offline Javier GarcíaFriend
Messages: 129
Registered: April 2013
Senior Member
Thanks a lot Sylvain, that fixed the problem!
Previous Topic:new instance in an ATL transformation
Next Topic:rule with multiple objects for one target pattern
Goto Forum:

Current Time: Tue Jun 19 01:25:32 GMT 2018

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

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

Back to the top