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
Hi,
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(ASMOperation.java:643)
	at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:208)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:170)
	at org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMUILauncher.launch(EMFVMUILauncher.java:46)
	at org.eclipse.m2m.atl.core.service.LauncherService.launch(LauncherService.java:136)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launchOrDebug(AtlLaunchConfigurationDelegate.java:300)
	at org.eclipse.m2m.atl.core.ui.launch.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:237)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:854)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:937)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1141)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
	at org.eclipse.m2m.atl.engine.emfvm.ASMOperation.exec(ASMOperation.java:456)
	... 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=http://www.eclipse.org/uml2/3.0.0/UML
-- @nsURI XML=http://www.eclipse.org/MoDisco/Xml/0.1.incubation/XML
-- @nsURI profile=http://www.eclipse.org/uml2/3.0.0/UML
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(self.name)
			and e.parent.name = 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,
regards,
Javier

[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: 556
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: Thu Mar 28 10:11:20 GMT 2024

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

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

Back to the top