Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4191910

Source code for java.awt.Component contains an unreachable statement

XMLWordPrintable

    • beta
    • x86
    • windows_nt



      Name: gsC80088 Date: 11/20/98


      The following method declaration in Component.java is ill-formed:

          public boolean imageUpdate(Image img, int flags,
      int x, int y, int w, int h) {
      int rate = -1;
      if ((flags & (FRAMEBITS|ALLBITS)) != 0) {
      rate = 0;
      } else if ((flags & SOMEBITS) != 0) {
      if (isInc) {
      try {
      rate = incRate;
      if (rate < 0)
      rate = 0;
      } catch (Exception e) {
      rate = 100;
      }
      }
      }
      if (rate >= 0) {
      repaint(rate, 0, 0, width, height);
      }
      return (flags & (ALLBITS|ABORT)) == 0;
          }

      The catch block is unreachable, and therefore the assignment "rate = 100;" is unreachable, which is a compile-time error.
      (Review ID: 41681)
      ======================================================================

            ehawkessunw Eric Hawkes (Inactive)
            gstone Greg Stone
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: