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

Implementation of equals+hashCode for composite scopes to prevent potential endless loops.

This commit is contained in:
Markus Schorn 2008-02-15 12:50:52 +00:00
parent 08cce46ebc
commit b5f0556e66

View file

@ -114,4 +114,25 @@ public abstract class CompositeScope implements IIndexScope {
public final IBinding[] getBindings(IASTName name, boolean resolve, boolean prefix) throws DOMException {
return getBindings(name, resolve, prefix, IIndexFileSet.EMPTY);
}
@Override
/**
* The c++-name resolution stores scopes in hash-maps, we need to make sure equality is detected
* in order to prevent infinite loops.
*/
public final boolean equals(Object other) {
if (other instanceof CompositeScope) {
return rbinding.equals(((CompositeScope)other).rbinding);
}
return false;
}
@Override
/**
* The c++-name resolution stores scopes in hash-maps, we need to make sure equality is detected
* in order to prevent infinite loops.
*/
public final int hashCode() {
return rbinding.hashCode();
}
}