1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Composite bindings should not be considered equal if their composite factories are different.

This commit is contained in:
Sergey Prigogin 2011-03-04 22:15:59 +00:00
parent b8ce1854d4
commit 0c4c2720e2
2 changed files with 6 additions and 14 deletions

View file

@ -96,15 +96,13 @@ public abstract class CompositeIndexBinding implements IIndexBinding {
}
@Override
public boolean equals(Object obj) {
if (obj == this)
public boolean equals(Object other) {
if (other == this)
return true;
if (obj instanceof IIndexFragmentBinding)
return rbinding.equals(obj);
if (obj instanceof CompositeIndexBinding)
return rbinding.equals(((CompositeIndexBinding) obj).rbinding);
return super.equals(obj);
if (!(other instanceof CompositeIndexBinding))
return false;
CompositeIndexBinding otherComposite = (CompositeIndexBinding) other;
return rbinding.equals(otherComposite.rbinding) && cf.equals(otherComposite.cf);
}
@Override

View file

@ -9,13 +9,11 @@
* Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.internal.core.index.composite.CompositeIndexBinding;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.db.Database;
import org.eclipse.core.runtime.CoreException;
@ -103,10 +101,6 @@ public abstract class PDOMNode implements IInternalPDOMNode {
public final boolean equals(Object obj) {
if (obj == this)
return true;
// For symmetry with CompositeIndexBinding.equals(Object)
if (obj instanceof CompositeIndexBinding) {
obj = ((CompositeIndexBinding) obj).getRawBinding();
}
if (obj instanceof PDOMNode) {
PDOMNode other = (PDOMNode) obj;
return getPDOM() == other.getPDOM() && record == other.record;