Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field removedSlots cleared too early in rehash #51

Open
niemisto opened this issue Oct 27, 2016 · 0 comments
Open

Field removedSlots cleared too early in rehash #51

niemisto opened this issue Oct 27, 2016 · 0 comments
Labels

Comments

@niemisto
Copy link

I noticed the following problem in rehash implementation, at least in MutableObjQHashSetSO.

    void rehash(int newCapacity) {
        int mc = modCount();
        Object[] keys = set;
        initForRehash(newCapacity);
        mc++; // modCount is incremented in initForRehash()
        Object[] newKeys = set;
        int capacity = newKeys.length;
        if (noRemoved()) {
            ...

The method initForRehash calls internalInit that calls initSlotCounts that sets removedSlots to zero. Therefore the test noRemoved() always succeeds even when the hash set contains REMOVED entries. This bug appears in koloboke-impl-jdk8 1.0.0 I downloaded from Maven central.

@leventov leventov added the bug label Oct 31, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants