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:
parent
08cce46ebc
commit
b5f0556e66
1 changed files with 21 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue