Program: 17272
Project: 17272
Buggy source:
/** 
 * Dispatches the added events to the listeners defined by the specified  {@link CacheEntryListenerRegistration}s.
 * @see #addEvent(Class,CacheEntryEvent)
 * @param registrations the {@link CacheEntryListenerRegistration} defining{@link CacheEntryListener}s to which to dispatch events
 */
public void dispatch(Iterable<CacheEntryListenerRegistration<? super K,? super V>> registrations){
  Iterable<CacheEntryEvent<K,V>> events;
  events=eventMap.get(CacheEntryExpiredListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryExpiredListener) {
        ((CacheEntryExpiredListener)listener).onExpired(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryCreatedListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryCreatedListener) {
        ((CacheEntryCreatedListener)listener).onCreated(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryReadListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryReadListener) {
        ((CacheEntryReadListener)listener).onRead(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryUpdatedListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryUpdatedListener) {
        ((CacheEntryUpdatedListener)listener).onUpdated(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryRemovedListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryRemovedListener) {
        ((CacheEntryRemovedListener)listener).onRemoved(iterable);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatches the added events to the listeners defined by the specified  {@link CacheEntryListenerRegistration}s.
 * @see #addEvent(Class,CacheEntryEvent)
 * @param registrations the {@link CacheEntryListenerRegistration} defining{@link CacheEntryListener}s to which to dispatch events
 */
public void dispatch(Iterable<CacheEntryListenerRegistration<? super K,? super V>> registrations){
  Iterable<CacheEntryEvent<K,V>> events;
  events=eventMap.get(CacheEntryExpiredListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryExpiredListener) {
        ((CacheEntryExpiredListener)listener).onExpired(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryCreatedListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryCreatedListener) {
        ((CacheEntryCreatedListener)listener).onCreated(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryUpdatedListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryUpdatedListener) {
        ((CacheEntryUpdatedListener)listener).onUpdated(iterable);
      }
    }
  }
  events=eventMap.get(CacheEntryRemovedListener.class);
  if (events != null) {
    for (    CacheEntryListenerRegistration<? super K,? super V> registration : registrations) {
      CacheEntryEventFilter<? super K,? super V> filter=registration.getCacheEntryFilter();
      Iterable<CacheEntryEvent<K,V>> iterable=filter == null ? events : new RICacheEntryEventFilteringIterable<K,V>(events,filter);
      CacheEntryListener<? super K,? super V> listener=registration.getCacheEntryListener();
      if (listener instanceof CacheEntryRemovedListener) {
        ((CacheEntryRemovedListener)listener).onRemoved(iterable);
      }
    }
  }
}