| Summary: | Revision compare does not consider EObject values in references | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Egidijus Vaisnora <vaisegid> | ||||||
| Component: | cdo.core | Assignee: | Eike Stepper <stepper> | ||||||
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | Ed.Merks, saulius.tvarijonas | ||||||
| Version: | 4.2 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | 351480 | ||||||||
| Bug Blocks: | |||||||||
| Attachments: |
|
||||||||
|
Description
Egidijus Vaisnora
Created attachment 199000 [details] test case v1 Issue was originated from https://bugs.eclipse.org/bugs/show_bug.cgi?id=349958 Created attachment 199126 [details]
premature fix
There are two drawbacks:
- I was needed to copy-paste list compare method from EMF. Need to overload object compare
- legacy object is not supported. All legacy object support is located in org.eclipse.emf.cdo component, but we need to use it in commons. Cyclic dependency
Looks like we hit on obstacles going this direction. I don't feel comfortable by copy and pasting emf compare methods and reworking simple object compare logic... In addition we will need to provide CDOObject and legacy object related code into "commons" component... Just looks like we are going into wrong direction and perhaps we should re-consider fix provided in https://bugs.eclipse.org/bugs/show_bug.cgi?id=349958. It is simple solution, which is working for current CDO architecture. Eike, what do you think? Ed, in your ListDifferenceAnalyzer.createListChanges() there's this part of a condition: oldValue.equals(newValue). Do you think it's affordable to refactor this condition into a protected method so that we can override it separately? I think it could even be additional: if (oldValue == null ? newValue == null : oldValue == newValue || oldValue.equals(newValue) || overrideableEquals(oldValue, newValue)) Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master. Now that ListDifferenceAnalyzer.equal(Object, Object) is protected (EMF 2.8) we can override and call:
private boolean compare(Object originValue, Object dirtyValue)
{
originValue = convertEObject(originValue);
dirtyValue = convertEObject(dirtyValue);
if (originValue == null)
{
return dirtyValue == null;
}
if (dirtyValue == null)
{
return false;
}
return originValue == dirtyValue || originValue.equals(dirtyValue);
}
private Object convertEObject(Object value)
{
CDOID id = CDOIDUtil.getCDOID(value);
if (id != null)
{
return id;
}
return value;
}
commit 607c5558dcc1916cb56e4733d4c7f198d551e809 Bugzilla_350987_Test.testRestoringReferences() fails in legacy scenarios. CDOLegacyWrapper.equals() should be moved up to CDOObjectWrapperBase and changed to:
@Override
public boolean equals(Object obj)
{
return obj == this || obj == instance || //
obj instanceof CDOObjectWrapperBase && ((CDOObjectWrapperBase)obj).instance == instance;
}
commit 5e4be45a27589a157ad508815635db8de61b5497 Available in R20130613-1157 (4.2) |