Program: 1941
Project: 1941
Buggy source:
/** 
 * {@inheritDoc}
 */
@SuppressWarnings({"String_Node_Str"}) @Override protected boolean dispatchHoverEvent(MotionEvent event){
  final int action=event.getAction();
  final boolean interceptHover=onInterceptHoverEvent(event);
  event.setAction(action);
  MotionEvent eventNoHistory=event;
  boolean handled=false;
  HoverTarget firstOldHoverTarget=mFirstHoverTarget;
  mFirstHoverTarget=null;
  if (!interceptHover && action != MotionEvent.ACTION_HOVER_EXIT) {
    final float x=event.getX();
    final float y=event.getY();
    final int childrenCount=mChildrenCount;
    if (childrenCount != 0) {
      final View[] children=mChildren;
      HoverTarget lastHoverTarget=null;
      for (int i=childrenCount - 1; i >= 0; i--) {
        final View child=children[i];
        if (!canViewReceivePointerEvents(child) || !isTransformedTouchPointInView(x,y,child,null)) {
          continue;
        }
        HoverTarget hoverTarget=firstOldHoverTarget;
        final boolean wasHovered;
        for (HoverTarget predecessor=null; ; ) {
          if (hoverTarget == null) {
            hoverTarget=HoverTarget.obtain(child);
            wasHovered=false;
            break;
          }
          if (hoverTarget.child == child) {
            if (predecessor != null) {
              predecessor.next=hoverTarget.next;
            }
 else {
              firstOldHoverTarget=hoverTarget.next;
            }
            hoverTarget.next=null;
            wasHovered=true;
            break;
          }
          predecessor=hoverTarget;
          hoverTarget=hoverTarget.next;
        }
        if (lastHoverTarget != null) {
          lastHoverTarget.next=hoverTarget;
        }
 else {
          lastHoverTarget=hoverTarget;
          mFirstHoverTarget=hoverTarget;
        }
        if (action == MotionEvent.ACTION_HOVER_ENTER) {
          if (!wasHovered) {
            handled|=dispatchTransformedGenericPointerEvent(event,child);
          }
        }
 else         if (action == MotionEvent.ACTION_HOVER_MOVE) {
          if (!wasHovered) {
            eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
            eventNoHistory.setAction(MotionEvent.ACTION_HOVER_ENTER);
            handled|=dispatchTransformedGenericPointerEvent(eventNoHistory,child);
            eventNoHistory.setAction(action);
            handled|=dispatchTransformedGenericPointerEvent(eventNoHistory,child);
          }
 else {
            handled|=dispatchTransformedGenericPointerEvent(event,child);
          }
        }
        if (handled) {
          break;
        }
      }
    }
  }
  while (firstOldHoverTarget != null) {
    final View child=firstOldHoverTarget.child;
    if (action == MotionEvent.ACTION_HOVER_EXIT) {
      handled|=dispatchTransformedGenericPointerEvent(event,child);
    }
 else {
      if (action == MotionEvent.ACTION_HOVER_MOVE) {
        dispatchTransformedGenericPointerEvent(event,child);
      }
      eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
      eventNoHistory.setAction(MotionEvent.ACTION_HOVER_EXIT);
      dispatchTransformedGenericPointerEvent(eventNoHistory,child);
      eventNoHistory.setAction(action);
    }
    final HoverTarget nextOldHoverTarget=firstOldHoverTarget.next;
    firstOldHoverTarget.recycle();
    firstOldHoverTarget=nextOldHoverTarget;
  }
  boolean newHoveredSelf=!handled;
  if (newHoveredSelf == mHoveredSelf) {
    if (newHoveredSelf) {
      handled|=super.dispatchHoverEvent(event);
    }
  }
 else {
    if (mHoveredSelf) {
      if (action == MotionEvent.ACTION_HOVER_EXIT) {
        handled|=super.dispatchHoverEvent(event);
      }
 else {
        if (action == MotionEvent.ACTION_HOVER_MOVE) {
          super.dispatchHoverEvent(event);
        }
        eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
        eventNoHistory.setAction(MotionEvent.ACTION_HOVER_EXIT);
        super.dispatchHoverEvent(eventNoHistory);
        eventNoHistory.setAction(action);
      }
      mHoveredSelf=false;
    }
    if (newHoveredSelf) {
      if (action == MotionEvent.ACTION_HOVER_ENTER) {
        handled|=super.dispatchHoverEvent(event);
        mHoveredSelf=true;
      }
 else       if (action == MotionEvent.ACTION_HOVER_MOVE) {
        eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
        eventNoHistory.setAction(MotionEvent.ACTION_HOVER_ENTER);
        handled|=super.dispatchHoverEvent(eventNoHistory);
        eventNoHistory.setAction(action);
        handled|=super.dispatchHoverEvent(eventNoHistory);
        mHoveredSelf=true;
      }
    }
  }
  if (eventNoHistory != event) {
    eventNoHistory.recycle();
  }
  return handled;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@SuppressWarnings({"String_Node_Str"}) @Override protected boolean dispatchHoverEvent(MotionEvent event){
  final int action=event.getAction();
  final boolean interceptHover=onInterceptHoverEvent(event);
  event.setAction(action);
  MotionEvent eventNoHistory=event;
  boolean handled=false;
  HoverTarget firstOldHoverTarget=mFirstHoverTarget;
  mFirstHoverTarget=null;
  if (!interceptHover && action != MotionEvent.ACTION_HOVER_EXIT) {
    final float x=event.getX();
    final float y=event.getY();
    final int childrenCount=mChildrenCount;
    if (childrenCount != 0) {
      final View[] children=mChildren;
      HoverTarget lastHoverTarget=null;
      for (int i=childrenCount - 1; i >= 0; i--) {
        final View child=children[i];
        if (!canViewReceivePointerEvents(child) || !isTransformedTouchPointInView(x,y,child,null)) {
          continue;
        }
        HoverTarget hoverTarget=firstOldHoverTarget;
        final boolean wasHovered;
        for (HoverTarget predecessor=null; ; ) {
          if (hoverTarget == null) {
            hoverTarget=HoverTarget.obtain(child);
            wasHovered=false;
            break;
          }
          if (hoverTarget.child == child) {
            if (predecessor != null) {
              predecessor.next=hoverTarget.next;
            }
 else {
              firstOldHoverTarget=hoverTarget.next;
            }
            hoverTarget.next=null;
            wasHovered=true;
            break;
          }
          predecessor=hoverTarget;
          hoverTarget=hoverTarget.next;
        }
        if (lastHoverTarget != null) {
          lastHoverTarget.next=hoverTarget;
        }
 else {
          mFirstHoverTarget=hoverTarget;
        }
        lastHoverTarget=hoverTarget;
        if (action == MotionEvent.ACTION_HOVER_ENTER) {
          if (!wasHovered) {
            handled|=dispatchTransformedGenericPointerEvent(event,child);
          }
        }
 else         if (action == MotionEvent.ACTION_HOVER_MOVE) {
          if (!wasHovered) {
            eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
            eventNoHistory.setAction(MotionEvent.ACTION_HOVER_ENTER);
            handled|=dispatchTransformedGenericPointerEvent(eventNoHistory,child);
            eventNoHistory.setAction(action);
            handled|=dispatchTransformedGenericPointerEvent(eventNoHistory,child);
          }
 else {
            handled|=dispatchTransformedGenericPointerEvent(event,child);
          }
        }
        if (handled) {
          break;
        }
      }
    }
  }
  while (firstOldHoverTarget != null) {
    final View child=firstOldHoverTarget.child;
    if (action == MotionEvent.ACTION_HOVER_EXIT) {
      handled|=dispatchTransformedGenericPointerEvent(event,child);
    }
 else {
      if (action == MotionEvent.ACTION_HOVER_MOVE) {
        dispatchTransformedGenericPointerEvent(event,child);
      }
      eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
      eventNoHistory.setAction(MotionEvent.ACTION_HOVER_EXIT);
      dispatchTransformedGenericPointerEvent(eventNoHistory,child);
      eventNoHistory.setAction(action);
    }
    final HoverTarget nextOldHoverTarget=firstOldHoverTarget.next;
    firstOldHoverTarget.recycle();
    firstOldHoverTarget=nextOldHoverTarget;
  }
  boolean newHoveredSelf=!handled;
  if (newHoveredSelf == mHoveredSelf) {
    if (newHoveredSelf) {
      handled|=super.dispatchHoverEvent(event);
    }
  }
 else {
    if (mHoveredSelf) {
      if (action == MotionEvent.ACTION_HOVER_EXIT) {
        handled|=super.dispatchHoverEvent(event);
      }
 else {
        if (action == MotionEvent.ACTION_HOVER_MOVE) {
          super.dispatchHoverEvent(event);
        }
        eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
        eventNoHistory.setAction(MotionEvent.ACTION_HOVER_EXIT);
        super.dispatchHoverEvent(eventNoHistory);
        eventNoHistory.setAction(action);
      }
      mHoveredSelf=false;
    }
    if (newHoveredSelf) {
      if (action == MotionEvent.ACTION_HOVER_ENTER) {
        handled|=super.dispatchHoverEvent(event);
        mHoveredSelf=true;
      }
 else       if (action == MotionEvent.ACTION_HOVER_MOVE) {
        eventNoHistory=obtainMotionEventNoHistoryOrSelf(eventNoHistory);
        eventNoHistory.setAction(MotionEvent.ACTION_HOVER_ENTER);
        handled|=super.dispatchHoverEvent(eventNoHistory);
        eventNoHistory.setAction(action);
        handled|=super.dispatchHoverEvent(eventNoHistory);
        mHoveredSelf=true;
      }
    }
  }
  if (eventNoHistory != event) {
    eventNoHistory.recycle();
  }
  return handled;
}