code: protected final LinearGradientPaint createGradient(float x1, float y1, float x2, float y2, float[] midpoints, Color[] colors) {
          if (x1 == x2 && y1 == y2) {
              y2 += .00001f;
          }
  
          return new LinearGradientPaint(x1, y1, x2, y2, midpoints, colors);
      }
docs: Given parameters for creating a LinearGradientPaint, this method will
  create and return a linear gradient paint. One primary purpose for this
  method is to avoid creating a LinearGradientPaint where the start and end
  points are equal. In such a case, the end y point is slightly increased
  to avoid the overlap.
  
  @param  x1
  @param  y1
  @param  x2
  @param  y2
  @param  midpoints
  @param  colors
  
  @return a valid LinearGradientPaint. This method never returns null.