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

Identify warnings - The analysis-core gives different contextHashCode for the same warnings

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • findbugs-plugin
    • None
    • Hudson, Findbugs, PMD

      I think the 'contextHashCode' depends on the seven lines around the warning line (up 3, down 3, warning in the centre).

      But if I add one/several lines in the java code, the same number of new and fixed warnings appear, meaning that the same warnings in the current and old build can not be identified.

      In a simple case,the source is,

      package foo;
      
      /**
       * Hello world!
       *
       */
      public class App 
      {                                                                          
          public static void main( String[] args )                                   
          {
              System.out.println( "Hello World!!!" );                                   
          }
      	public boolean equals(Object o){
      		return true;
      		}	
           			
         }
      
      

      Then I add one line in the top of the file, which does not affect the code;

      But the build result tells that there are two new warnings and fixed warnings;(see pic1)

      And I find that the contextHashCode of the warnings in the current build and old builds are not the same.(see findbugs-warnings (1).xml and findbugs-warnings .xml)

          [JENKINS-6669] Identify warnings - The analysis-core gives different contextHashCode for the same warnings

          tanyunshi created issue -
          tanyunshi made changes -
          Attachment New: findbugs-warnings (1).xml [ 19473 ]
          Ulli Hafner made changes -
          Description Original: I think the 'contextHashCode' depends on the seven lines around the warning line (up 3, down 3, warning in the centre).

          But if I add one/several lines in the java code, the same number of new and fixed warnings appear, meaning that the same warnings in the current and old build can not be identified.

          In a simple case,the source is,
          --------------------------------------------------------------

          package foo;

          /**
           * Hello world!
           *
           */
          public class App
          {
              public static void main( String[] args )
              {
                  System.out.println( "Hello World!!!" );
              }
          public boolean equals(Object o){
          return true;
          }
               
             }

          -------------------------------------------------------------------
          Then I add one line in the top of the file, which does not affect the code;

          But the build result tells that there are two new warnings and fixed warnings;(see pic1)

          And I find that the contextHashCode of the warnings in the current build and old builds are not the same.(see findbugs-warnings (1).xml and findbugs-warnings .xml)

          New: I think the 'contextHashCode' depends on the seven lines around the warning line (up 3, down 3, warning in the centre).

          But if I add one/several lines in the java code, the same number of new and fixed warnings appear, meaning that the same warnings in the current and old build can not be identified.

          In a simple case,the source is,

          {code}
          package foo;

          /**
           * Hello world!
           *
           */
          public class App
          {
              public static void main( String[] args )
              {
                  System.out.println( "Hello World!!!" );
              }
          public boolean equals(Object o){
          return true;
          }
               
             }

          {code}

          Then I add one line in the top of the file, which does not affect the code;

          But the build result tells that there are two new warnings and fixed warnings;(see pic1)

          And I find that the contextHashCode of the warnings in the current build and old builds are not the same.(see findbugs-warnings (1).xml and findbugs-warnings .xml)

          Ulli Hafner made changes -
          Component/s New: findbugs [ 15496 ]
          Component/s Original: analysis-core [ 15709 ]

          Ulli Hafner added a comment -

          Actually for findbugs the instanceHash field should be used to check for equal warnings. This seems to be broken (the instanceHash is the same in both of your files).

          Ulli Hafner added a comment - Actually for findbugs the instanceHash field should be used to check for equal warnings. This seems to be broken (the instanceHash is the same in both of your files).

          Code changed in hudson
          User: : drulli
          Path:
          trunk/hudson/plugins/findbugs/plugin/src/main/java/hudson/plugins/findbugs/parser/Bug.java
          trunk/hudson/plugins/findbugs/plugin/src/test/java/hudson/plugins/findbugs/parser/BugsDifferencerTest.java
          trunk/hudson/plugins/findbugs/plugin/src/test/resources/hudson/plugins/findbugs/parser/issue-6669-1.xml
          trunk/hudson/plugins/findbugs/plugin/src/test/resources/hudson/plugins/findbugs/parser/issue-6669-2.xml
          http://jenkins-ci.org/commit/31565
          Log:
          [FIXED JENKINS-6669] Don't use super when computing hashCode.

          SCM/JIRA link daemon added a comment - Code changed in hudson User: : drulli Path: trunk/hudson/plugins/findbugs/plugin/src/main/java/hudson/plugins/findbugs/parser/Bug.java trunk/hudson/plugins/findbugs/plugin/src/test/java/hudson/plugins/findbugs/parser/BugsDifferencerTest.java trunk/hudson/plugins/findbugs/plugin/src/test/resources/hudson/plugins/findbugs/parser/issue-6669-1.xml trunk/hudson/plugins/findbugs/plugin/src/test/resources/hudson/plugins/findbugs/parser/issue-6669-2.xml http://jenkins-ci.org/commit/31565 Log: [FIXED JENKINS-6669] Don't use super when computing hashCode.
          SCM/JIRA link daemon made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Ulli Hafner made changes -
          Link New: This issue is duplicated by JENKINS-2968 [ JENKINS-2968 ]

          Ulli Hafner added a comment -

          Integrated in Hudson Plug-ins (Compile) #6
          [FIXED JENKINS-6669] Don't use super when computing hashCode.

          Ulli Hafner added a comment - Integrated in Hudson Plug-ins (Compile) #6 [FIXED JENKINS-6669] Don't use super when computing hashCode.

          Ulli Hafner added a comment -

          Integrated in Hudson Plug-ins #87
          [FIXED JENKINS-6669] Don't use super when computing hashCode.

          Ulli Hafner added a comment - Integrated in Hudson Plug-ins #87 [FIXED JENKINS-6669] Don't use super when computing hashCode.

            drulli Ulli Hafner
            tanyunshi tanyunshi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: