incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gabriele renzi <rff....@gmail.com>
Subject what are utils.Fast* for?
Date Sat, 05 Dec 2009 11:14:16 GMT
Hi everyone,

while trying to get a grasp of the codebase in cassandra, I run
FindBugs on it and got a complaint about this code in
org.apache.cassandra.utils.FastHashMap.containsValue(Object)

"""
        // special case null values so that we don't have to
        // perform null checks before every call to equals()
        if (null == val)
        {
            for (int i = vals.length; i-- > 0;)
            {
                if ((set[i] != FREE && set[i] != REMOVED) && val == vals[i])
                {
                    return true;
                }
            }
        }
"""

as Findbugs would prefer the last condition to be spelled as
 null == vals[i]

I wanted to look around to check this was not a bug, but then I
wondered what is this class for. Apparently all of FastHashMap,
FastObjechHash, FastLinkedHashMap, and FastHash are never used
anywhere in the code:

$ ack 'Fast(Linked|Hash|Object)'  -l
src/java/org/apache/cassandra/utils/FastHash.java
src/java/org/apache/cassandra/utils/FastHashMap.java
src/java/org/apache/cassandra/utils/FastLinkedHashMap.java
src/java/org/apache/cassandra/utils/FastObjectHash.java
$


Does anyone have an explanation for this  (e.g. they are loaded by
reflection by concatenating strings) or are they just remnants of old
code?

Mime
View raw message