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

compiler reports bad line number

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1
    • 1.1
    • tools
    • None
    • 1.1beta3
    • x86, sparc
    • solaris_2.5, solaris_2.5.1, windows_95
    • Not verified

      The following file produces an error on line 16383, which is a bit wrong. The error is:

      javac -g Tree.java
      Tree.java:16383: Invalid method declaration; return type required.
       
      ^
      1 error

      -----------------------------------------------------------------------

      import java.awt.*;
       
      public class Tree extends Canvas {
          private final static int WIDTH = 300;
          private final static int HEIGHT = 500;
          private final static int BORDER = 5;
       
          private final static int MIDDLE_X = WIDTH / 2;
          private final static int MIDDLE_Y = HEIGHT / 2;
          private final static int TOP = BORDER;
          private final static int BOTTOM = HEIGHT - BORDER;
          private final static int LEFT = BORDER;
          private final static int RIGHT = WIDTH - BORDER;
       
          private static int[] topX = { MIDDLE_X, LEFT + 30, RIGHT - 30 };
          private static int[] topY = { TOP, TOP + 100, TOP + 100 };
       
          private Polygon top;
       
          Tree() {
              top = new Polygon();
              for (i = 0; i < topX.length; i++)
                  top.add(topX[i], topY[i]);
          }
       
          draw(Graphics g) {
              g.drawPolygon(top);
          }
      }

            jrose John Rose
            karnoldsunw Kenneth Arnold (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: