Broken code sample in Java Tutorials only issues one error message

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • None
    • Affects Version/s: 8
    • Component/s: docs
    • None

      From http://docs.oracle.com/javase/tutorial/getStarted/problems/index.html

      ===============

      Sometimes the compiler can’t guess your intent and prints a confusing error message or multiple error messages if the error cascades over several lines. For example, the following code snippet omits a semicolon (;) from the bold line:

      while (System.in.read() != -1)
          count++
      System.out.println("Input has " + count + " chars.");

      When processing this code, the compiler issues two error messages:

      testing.java:13: Invalid type expression.
              count++
                       ^
      testing.java:14: Invalid declaration.
          System.out.println("Input has " + count + " chars.");
                            ^
      2 errors

      ===============

      The broken code sample only issues one error.

            Assignee:
            Raymond Gallardo
            Reporter:
            Raymond Gallardo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: