Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-12482

Warnings not detected when file path does not appear after [WARNING]

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: warnings-plugin
    • Labels:
      None
    • Environment:
      ubuntu, java 1.7.0_02, tomcat7, jenkins 1.447, warnings plugin v3.26, maven-compiler-plugin v2.3.2
    • Similar Issues:

      Description

      When compiling a Java project using the javac compiler, most of the warnings in my console log appear as follows:

      [WARNING]     BasicTableInfo
      /absolute/path/to/source/File.java:[143,66] [unchecked] unchecked conversion
      

      and are thus not picked up by the warnings plugin.

      When there is no additional token before the source file path, such as in the following warning:

      [WARNING] /absolute/path/to/source/File.java:[181,69] [unchecked] unchecked cast
      

      then the warning is correctly picked up by the warnings plugin.

      Btw: Coloring in the console log has the same "bug": when the path appears as the first token (after [WARNING]), then the path and the next token (warning category) are highlighted in dark-yellow. When there is an additional token before the path, only that additional token is highlighted in dark-yellow (not the path and subsequent tokens).

        Attachments

          Activity

          Hide
          drulli Ulli Hafner added a comment -

          Seems that the warning format has been changed in JDK 7. Is there a javac switch to get the old behavior? Is the token just the Java class name?

          Show
          drulli Ulli Hafner added a comment - Seems that the warning format has been changed in JDK 7. Is there a javac switch to get the old behavior? Is the token just the Java class name?
          Hide
          stefanthurnherr Stefan Thurnherr added a comment -

          I get about 60 warnings in the console output of my Jenkins build.

          • 2 are picked up by the warnings plugin - those have the format as expected by the warnings plugin (see above)
          • Many warnings have the unexpected format mentioned in the description (additional class name token after [WARNING]), but I now believe the file path comes before [WARNING], i.e.:
            /absolute/path/to/SourceFile.java:[185,66] [unchecked] unchecked conversion
            [WARNING]     BasicTableInfo
            
          • Some have the following format:
            /absolute/path/to/SourceFile.java:[858,24] [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
            [WARNING] 
                K extends Object declared in class HashMap
                V extends Object declared in class HashMap
            

          Haven't found anything on the web (using google) about how the output for -Xlint:unchecked has changed in java 7. The javac documentation does not mention anything, and neither does the 9.6.1.5 of the Java Language Specification. Probably not specified and thus subject to changes with any minor/major release?

          I'll get a JDK6 installed again, to be able to compare the output side-by-side.

          Show
          stefanthurnherr Stefan Thurnherr added a comment - I get about 60 warnings in the console output of my Jenkins build. 2 are picked up by the warnings plugin - those have the format as expected by the warnings plugin (see above) Many warnings have the unexpected format mentioned in the description (additional class name token after [WARNING] ), but I now believe the file path comes before [WARNING] , i.e.: /absolute/path/to/SourceFile.java:[185,66] [unchecked] unchecked conversion [WARNING] BasicTableInfo Some have the following format: /absolute/path/to/SourceFile.java:[858,24] [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap [WARNING] K extends Object declared in class HashMap V extends Object declared in class HashMap Haven't found anything on the web (using google) about how the output for -Xlint:unchecked has changed in java 7. The javac documentation does not mention anything, and neither does the 9.6.1.5 of the Java Language Specification . Probably not specified and thus subject to changes with any minor/major release? I'll get a JDK6 installed again, to be able to compare the output side-by-side.
          Hide
          stefanthurnherr Stefan Thurnherr added a comment -

          Can confirm that it's a Java 7 issue. Here's a java7 vs. java6 comparison:

          //Java 6 (1.6.0_30-b12)
          [WARNING] /absolute/path/to/source/File.java:[1185,66] [unchecked] unchecked conversion
          found   : com.company.util.db.BasicTableInfo
          required: com.company.util.db.TableInfo<com.company.fps.storable.Storable>
          [WARNING] /absolute/path/to/source/File.java:[729,21] [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector
          [WARNING] /absolute/path/to/source/File.java:[858,24] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.HashMap
          [WARNING] /absolute/path/to/source/File.java:[281,66] [unchecked] unchecked conversion
          found   : java.util.Map
          required: java.util.Map<java.lang.String,byte[]>
          
          //Java 7 (1.7.0_02-b13)
          /absolute/path/to/source/File.java:[1185,66] [unchecked] unchecked conversion
          [WARNING]     BasicTableInfo
          /absolute/path/to/source/File.java:[729,21] [unchecked] unchecked call to addElement(E) as a member of the raw type Vector
          [WARNING] 
              E extends Object declared in class Vector
          /absolute/path/to/source/File.java:[858,24] [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap
          [WARNING] 
              K extends Object declared in class HashMap
              V extends Object declared in class HashMap
          /absolute/path/to/source/File.java:[281,66] [unchecked] unchecked conversion
          [WARNING]     Map
          
          Show
          stefanthurnherr Stefan Thurnherr added a comment - Can confirm that it's a Java 7 issue. Here's a java7 vs. java6 comparison: //Java 6 (1.6.0_30-b12) [WARNING] /absolute/path/to/source/File.java:[1185,66] [unchecked] unchecked conversion found : com.company.util.db.BasicTableInfo required: com.company.util.db.TableInfo<com.company.fps.storable.Storable> [WARNING] /absolute/path/to/source/File.java:[729,21] [unchecked] unchecked call to addElement(E) as a member of the raw type java.util.Vector [WARNING] /absolute/path/to/source/File.java:[858,24] [unchecked] unchecked call to put(K,V) as a member of the raw type java.util.HashMap [WARNING] /absolute/path/to/source/File.java:[281,66] [unchecked] unchecked conversion found : java.util.Map required: java.util.Map<java.lang.String,byte[]> //Java 7 (1.7.0_02-b13) /absolute/path/to/source/File.java:[1185,66] [unchecked] unchecked conversion [WARNING] BasicTableInfo /absolute/path/to/source/File.java:[729,21] [unchecked] unchecked call to addElement(E) as a member of the raw type Vector [WARNING] E extends Object declared in class Vector /absolute/path/to/source/File.java:[858,24] [unchecked] unchecked call to put(K,V) as a member of the raw type HashMap [WARNING] K extends Object declared in class HashMap V extends Object declared in class HashMap /absolute/path/to/source/File.java:[281,66] [unchecked] unchecked conversion [WARNING] Map
          Hide
          drulli Ulli Hafner added a comment -

          Ok, I see. Seems that I need to add an additional parser for Java 7 (or extend the current one). Can you please attach the warnings from your comment above as a file? Seems that not all white space characters are preserved in the comment.

          Show
          drulli Ulli Hafner added a comment - Ok, I see. Seems that I need to add an additional parser for Java 7 (or extend the current one). Can you please attach the warnings from your comment above as a file? Seems that not all white space characters are preserved in the comment.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Ulli Hafner
          Path:
          src/main/java/hudson/plugins/warnings/parser/JavacParser.java
          src/test/java/hudson/plugins/warnings/parser/JavacParserTest.java
          src/test/resources/hudson/plugins/warnings/parser/issue12482-java6.txt
          src/test/resources/hudson/plugins/warnings/parser/issue12482-java7.txt
          http://jenkins-ci.org/commit/warnings-plugin/bf57fb2ccd81975749a6ce821e1b08d114bd3ce8
          Log:
          [FIXED JENKINS-12482] Improved regular expression of JavaC parser to
          support Java 7 compiler format.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ulli Hafner Path: src/main/java/hudson/plugins/warnings/parser/JavacParser.java src/test/java/hudson/plugins/warnings/parser/JavacParserTest.java src/test/resources/hudson/plugins/warnings/parser/issue12482-java6.txt src/test/resources/hudson/plugins/warnings/parser/issue12482-java7.txt http://jenkins-ci.org/commit/warnings-plugin/bf57fb2ccd81975749a6ce821e1b08d114bd3ce8 Log: [FIXED JENKINS-12482] Improved regular expression of JavaC parser to support Java 7 compiler format.
          Hide
          dogfood dogfood added a comment -

          Integrated in plugins_warnings #355
          [FIXED JENKINS-12482] Improved regular expression of JavaC parser to (Revision bf57fb2ccd81975749a6ce821e1b08d114bd3ce8)

          Result = SUCCESS
          Ulli Hafner :
          Files :

          • src/test/resources/hudson/plugins/warnings/parser/issue12482-java7.txt
          • src/test/resources/hudson/plugins/warnings/parser/issue12482-java6.txt
          • src/main/java/hudson/plugins/warnings/parser/JavacParser.java
          • src/test/java/hudson/plugins/warnings/parser/JavacParserTest.java
          Show
          dogfood dogfood added a comment - Integrated in plugins_warnings #355 [FIXED JENKINS-12482] Improved regular expression of JavaC parser to (Revision bf57fb2ccd81975749a6ce821e1b08d114bd3ce8) Result = SUCCESS Ulli Hafner : Files : src/test/resources/hudson/plugins/warnings/parser/issue12482-java7.txt src/test/resources/hudson/plugins/warnings/parser/issue12482-java6.txt src/main/java/hudson/plugins/warnings/parser/JavacParser.java src/test/java/hudson/plugins/warnings/parser/JavacParserTest.java

            People

            • Assignee:
              drulli Ulli Hafner
              Reporter:
              stefanthurnherr Stefan Thurnherr
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: