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

javac should differentiate better between warnings and errors

XMLWordPrintable

    • 1.1
    • x86
    • windows_nt
    • Not verified

      Currently (with 1.01) the javac compiler doesn't follow compiler standards regarding the
      differences between warnings and errors. There are some cases, like the following, where
      problems are flagged as warnings, but, at the end of compilation, they are considered errors.

      For example:

      rockaway% javac sayerrorifyoumeanerror.java
      sayerrorifyoumeanerror.java:1: Warning: Public class saywarningifyoumeanwarning must be defined in a file called "saywarningifyoumeanwarning.java".
      public class saywarningifyoumeanwarning {
                   ^
      1 error

      Note, that the compiler gives a warning first (which usually implies with most compilers, that there is some non-fatal problem),
      but, then and the end of compilation, it considers this warning an error - this causes confusion for customers like what is reported
      in the following customer account:

      [from a customer]
      When I [...] build my project, it says:
      xxx.java:38: No constructor matching CircleObject(int, int, int, java.awt.Color, java.awt.Graphics) found in class CircleObject.
      xxx.java:80: Warning: Public class CircleObject must be defined in a file called "CircleObject.java".
      2 errors

      You should say
      1 error
      1 warning

      instead of
      2 errors

      The difference being: An error means that you didn't get a .class file.
      A warning means that you did get a .class file, but the code should be fixed.

      If I get 1 or more real warnings, I should get a .class file.
      If I get 1 or more real errors, then I should not get a .class file

            fyellinsunw Frank Yellin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: