[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: Is it possible that ECoreUtil.Copy() changes an EObject?

thank you Ed for your fast reply. The problem was in model. An Attribute of one of containments had its derived value set to true. I don't how it fixed the problem, but it was the cause.


Ed Merks schrieb:
Zardosht,

This should not be possible. You could add an adapter to listen for any changes. E.g., you might use an EContentAdapter on the original object to monitor any notifications that changes would produce...



Zardosht Hodaie wrote:
Hi all,

I encountered a problem using ECoreUtil.Copy() method. Here are the steps I did:

1. create objA (it contains a hierarchy of containments and EObjects referencing each other)
2. copy to create objB (objB = (cast)ECoreUtil.Copy(objA))
3. serialize both objects to separate files


Now i expect that the two files have exactly identical contents. But they differ in just one line, in which two references of an ordered containment are output vice versa.
I am sure that no problem occurs during serialization as i checked the serialization routine with the same object (i.e. serialize(objA, objA)) and both files were identical. That is, EcoreUtil.Copy() changes contents of objA as its being copied to objB.


Can someone please explain what is the possible problem?

Thanks in advance,
Zardosht