Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Strange error with the __xmiID__ field
Strange error with the __xmiID__ field [message #1850240] Tue, 22 February 2022 12:54 Go to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
I'm developing a transformation from UML to a custom Ecore metamodel.

This transformation sets the xmi:id of all the target element using the __xmiID__ special field. However if some input models are transformed as expected, some others (always the same ones) generate the following error on one line where this field is assigned a value:

org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.NoSuchFieldException: Field MM1!ElementX::__xmiID__ not found

Since the very same rules run fine with some models, I don't think that the root cause is actually that this field is not found. Do you have any idea about where it can come from ?

Thanks.


Yves
Re: Strange error with the __xmiID__ field [message #1850280 is a reply to message #1850240] Wed, 23 February 2022 17:59 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

This is the code from EMFTVM that handles setting the __xmiID__ property:
			if (EMFTVMUtil.XMI_ID_FEATURE.equals(propname) && resource instanceof XMIResource) { //$NON-NLS-1$
				if (queueSet) {
					env.queueXmiIDForSet(eo, v, frame);
				} else {
					((XMIResource)resource).setID(eo, v.toString());
				}
				return;
			}
			throw new NoSuchFieldException(String.format("Field %s::%s not found", 
					EMFTVMUtil.toPrettyString(type, env), propname));

See:

So the only way __xmiID__ is not found is when the model is not an XMIResource.


Cheers,
Dennis
Re: Strange error with the __xmiID__ field [message #1851279 is a reply to message #1850280] Fri, 01 April 2022 10:21 Go to previous messageGo to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Thanks Dennis. This is interesting. Since this errors may appear or not on the very same test case, it confirms that it is linked to deep perturbation of the framework!

Yves
Re: Strange error with the __xmiID__ field [message #1851298 is a reply to message #1851279] Fri, 01 April 2022 17:14 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Another situation that may be happening here is that the target element you're trying to set the __xmiID__ on is orphaned at that moment, i.e. it has a null Resource. EMFTVM normally verifies - every time a reference is set - that each element is contained in the Resource of the Model it belongs to, but custom metamodels can break that guarantee by manipulating the EMF containment hierarchy in Java code.

Cheers,
Dennis
Re: Strange error with the __xmiID__ field [message #1852086 is a reply to message #1851298] Thu, 28 April 2022 15:52 Go to previous message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Hello Dennis,

For any reason I didn't get the notification of your last reply, and so I missed it. That's unfortunate because this is very interesting, I'm even pretty sure that this is what happens!
Thanks a lot for this clue!!! :-)



Yves
Previous Topic:How to print output of ATL programs to eclipse console
Next Topic:Create target UML Association with conditions
Goto Forum:
  


Current Time: Sat Nov 11 08:17:07 GMT 2023

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

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

Back to the top