Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [henshin-user] Issue with (and fix for) EGraph.copy

Hi Steffen,

thanks! What you describe makes sense. Therefore, I have modified EGraphImpl.copy() to use your copier in case that the EGraph contains instances from Ecore: [1] https://git.eclipse.org/r/#/c/105679/

Best regards,
Daniel

Am 21.09.2017 um 12:39 schrieb Steffen Zschaler:
Hi,

I've been trying to run some transformations over meta-models (i.e., instances of Ecore). As part of this, I needed to copy EGraphs and used EGraph.copy. This crashed with an NPE.

I did some digging and found out that the reason is that there is an issue with how EcoreUtil.Copier works and how types and generic types are handled in Ecore. Details here: https://stackoverflow.com/questions/46323548/copying-egenerictype-instances-with-ecoreutil-copier As a result, when calling EGraph.copy (null), in some cases the code can then not find copies of the EGenericType instances in the resulting map and adding them to the new graph crashes.

I have written a slightly extended version of EcoreUtil.Copier which I attach. I have so far used this like in the code below, but was wondering whether there's an interest to include this directly into Henshin instead.

// Given a graph graph1 with some Ecore instances in it
EcoreCopier copier = new EcoreCopier();
copier.copyAll(graph1.getRoots());
copier.copyReferences();

EGraph graph2 = graph1.copy(copier);

Best regards,

Steffen



_______________________________________________
henshin-user mailing list
henshin-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/henshin-user


Back to the top