code: @Override
      public void clip(Shape s) {
          if (s instanceof Line2D) {
              s = s.getBounds2D();
          }
          if (this.clip == null) {
              setClip(s);
              return;
          }
          Shape ts = this.transform.createTransformedShape(s);
          if (!ts.intersects(this.clip.getBounds2D())) {
              setClip(new Rectangle2D.Double());
          } else {
            Area a1 = new Area(ts);
            Area a2 = new Area(this.clip);
            a1.intersect(a2);
            this.clip = new Path2D.Double(a1);
          }
          this.clipRef = null;
      }
docs: Clips to the intersection of the current clipping region and the
  specified shape.
  
  According to the Oracle API specification, this method will accept a
  {@code null} argument, but there is an open bug report (since 2004)
  that suggests this is wrong:
  <p>
  <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206189">
  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206189</a>
  
  @param s  the clip shape ({@code null} not permitted).