Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Issue with cached Helpers(Duplicate Entry exception with Association Classes)
Issue with cached Helpers [message #1860621] Tue, 22 August 2023 08:01 Go to next message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
I have defined a helper that has UML!Element as a context, no input parameter and that return a Boolean value.

It works fine with any input element kind except Association Classes. In that case, the following exception is raised:

org.eclipse.m2m.atl.emftvm.util.VMException: org.eclipse.m2m.atl.emftvm.util.DuplicateEntryException:

Superkeys
org.eclipse.emf.ecore.impl.EClassImpl@5f18a74d (name: Class) (instanceClassName: null) (abstract: false, interface: false) and
org.eclipse.emf.ecore.impl.EClassImpl@5b0d50a7 (name: Association) (instanceClassName: null) (abstract: false, interface: false)

both have an entry in
{...(map content)...}

If I rewrite the helper so that it has no context and take the element to be evaluated has an input parameter, it works fine with any kind of element, Association Classes as well.

So it looks like the problem comes from the map that the first version of the helper uses for caching its results and that does not work well with Association Classes.

Did you ever experience a similar issue and if so, did you find a workaround?

Thanks.


Yves
Re: Issue with cached Helpers [message #1860637 is a reply to message #1860621] Tue, 22 August 2023 18:07 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

That's a bug allright. It's triggered by the multiple inheritance situation for AssociationClass. If you first invoke the helper attribute on a Class as well as an Association, EMFTVM will cache that helper attribute directly under Class and Association, so it won't have to traverse the inheritance hierarchy the next time you need to use the helper attribute on the same context type. See https://git.eclipse.org/c/mmt/org.eclipse.atl.git/tree/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/FieldContainer.java#n95

However, the code linked above is naive, and makes it look like the helper attribute in question is actually defined on both Class and Association, and a diamond problem exists when trying to use the helper attribute on the common subclass AssociationClass.


Cheers,
Dennis
Re: Issue with cached Helpers [message #1860638 is a reply to message #1860637] Tue, 22 August 2023 18:12 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 581
Registered: September 2012
Location: Belgium
Senior Member

Logged https://bugs.eclipse.org/bugs/show_bug.cgi?id=582322

Cheers,
Dennis
Re: Issue with cached Helpers [message #1860640 is a reply to message #1860638] Wed, 23 August 2023 05:56 Go to previous message
Yves BERNARD is currently offline Yves BERNARDFriend
Messages: 146
Registered: July 2014
Senior Member
Thank you Dennis! :-)

Yves
Previous Topic:ATL 4.8.0 released
Next Topic:Assigning values to a Map owned by a target element
Goto Forum:
  


Current Time: Sat Nov 11 08:16:52 GMT 2023

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

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

Back to the top