private TypeCachingLock getCacheLockForKey(TypeCache.SimpleKey key) {
    int hashCode = key.hashCode();
    // Try to spread some higher bits with XOR to lower bits, because we only use lower bits.
    hashCode = hashCode ^ (hashCode >>> 16);
    int index = hashCode & CACHE_LOCK_MASK;
    return cacheLocks[index];
  }
Returns a {@link TypeCachingLock}, which locks the {@link TypeCache#findOrInsert(ClassLoader, Object, Callable, Object)}.

@param key the key to lock
@return the {@link TypeCachingLock} to use to lock the {@link TypeCache}
spock-core/src/main/java/org/spockframework/mock/runtime/ByteBuddyMockFactory.java