ArrayIndexOutOfBoundsException with ->at(1) although size is 2 [message #1062599] |
Sun, 09 June 2013 18:30 |
Stefan L Messages: 13 Registered: July 2012 |
Junior Member |
|
|
Hi again,
I encountered a weird problem which I'm not able to resolve.
In my example below, I try to access the first list entry, which is again a list containing two Lifelines. But somehow, I'm not able to access position 1 when using ->at(1) or ->first().
"getAssociations" returns a list (with length n). Each list entry contains another list (size is awlays 2). So it basically looks like the following:
[[light:Light:Lifeline, switch:Switch:Lifeline], [... , ...] ...]
Source Code:
lazy rule ClassOwnedAttributeAssociation {
from rcv: UML2!"uml::Lifeline", snd: UML2!"uml::Lifeline"
to
t: UML2!"uml::Property" (
name <- (thisModule.getAssociations()->select(a |
if a->at(1) = rcv
then
true
else
false
endif))->flatten()->at(1).toString()
do {
t;
}
Further the list gets flatten, resulting in a list with exactly two Lifelines. After this step, I just can't get any further
The error occurs at the ->at(1) or ->first() respectively:
endif))->flatten()->at(1).toString()
Error Message when calling with ->at(1):
Exception in thread "main" org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.ArrayIndexOutOfBoundsException
at public java.lang.Object org.eclipse.m2m.atl.emftvm.util.LazyList.at(int)
Local variables: []
at rule ClassOwnedAttributeAssociation@applier#7(../AtlTransform/test/test.atl#[104:12-110:30])
Local variables: [__trace__: TRACE!TraceLink = 78e12210:TRACE!TraceLink, rcv: UML2!uml::Lifeline = switch:Switch:UML2!Lifeline, snd: UML2!uml::Lifeline = switch:Switch:UML2!Lifeline, t: UML2!uml::Property = 7c2942ce:UML2!Property]
at rule Lifeline2Class@applier#41(../AtlTransform/test/test.atl#[192:31-197:7])
Local variables: [__trace__: TRACE!TraceLink = 318fddfb:TRACE!TraceLink, s: UML2!uml::Lifeline = switch:Switch:UML2!Lifeline, t: UML2!uml::Class = switch:Switch:UML2!Class]
at static EMFTVM!ExecEnv::main() : Object(../AtlTransform/test/test.atl)
Local variables: []
at org.eclipse.m2m.atl.emftvm.util.EMFTVMUtil.invokeNative(EMFTVMUtil.java:1038)
Error Message when calling with ->first():
Exception in thread "main" org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.UnsupportedOperationException: #native!org.eclipse.m2m.atl.emftvm.util.LazyList::at()
at rule ClassOwnedAttributeAssociation@applier#6(../AtlTransform/test/test.atl#[104:12-110:29])
Local variables: [__trace__: TRACE!TraceLink = 78e12210:TRACE!TraceLink, rcv: UML2!uml::Lifeline = switch:Switch:UML2!Lifeline, snd: UML2!uml::Lifeline = switch:Switch:UML2!Lifeline, t: UML2!uml::Property = 7c2942ce:UML2!Property]
at rule Lifeline2Class@applier#41(../AtlTransform/test/test.atl#[192:31-197:7])
Local variables: [__trace__: TRACE!TraceLink = 15b346d0:TRACE!TraceLink, s: UML2!uml::Lifeline = switch:Switch:UML2!Lifeline, t: UML2!uml::Class = switch:Switch:UML2!Class]
at static EMFTVM!ExecEnv::main() : Object(../AtlTransform/test/test.atl)
Local variables: []
at org.eclipse.m2m.atl.emftvm.impl.CodeBlockImpl.internalExecute(CodeBlockImpl.java:989)
I would appreciate some help.
Thanks!
Stefan
[Updated on: Sun, 09 June 2013 19:52] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01842 seconds