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

Need javac option to treat warnings as errors.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.2
    • tools
    • sparc
    • solaris_8



      Name: jl125535 Date: 04/15/2004


      A DESCRIPTION OF THE REQUEST :
      The javac tool needs an option similar to the gcc option '-Werror' to treat all compiler warnings as errors (i.e. fail to generate class file in that case and exit with appropriate error code).

      JUSTIFICATION :
      With recent version of Java (especially 1.5) warnings are being used more frequently and in many cases these warnings should not be ignored. However, with existing tools it is sometimes hard to stop compilation when warnings are issued because the compiler generates code and exits with a normal return value. It would be nice to have an option similar to the gcc option '-Werror' which is very useful to ensure your code compiles cleanly.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When the user uses this option then the compiler should generate warning messages as it does now. If the code does generate warnings then the compiler should not generate any .class files for the code in question and should exit with a non-zero return value.
      ACTUAL -
      This option currently doesn't exist (as far as I can see).

      CUSTOMER SUBMITTED WORKAROUND :
      Depending on the toolset used to compile code there may not be any workaround at all.
      (Incident Review ID: 250461)
      ======================================================================

            gafter Neal Gafter (Inactive)
            jleesunw Jon Lee (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: