Details

    • Type: Wish Wish
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Exclusions
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Hi guys,

      I just discovered the promising javax.annotation.Generated annotation [1]. I think this could be a very good solution to allow easy configuration of all quality tools (findbugs, cobertura, pmd, checkstyle, ...) that have to ignore generated code.

      I understand this is not only Sonar but all these tools that have to be updated to support this annotation. BTW I think it could be great to track here the progress on this area.

      The best would be that code generators themselves automatically add the @Generated(value=SOURCE) to the class/method/attribute with the correct value (ie modello, wsdl2java, ...). This way we could configure Sonar to ignore all code generated by a specific list of source code generators.

      It seems that JPA 2 will use @Generated on the metamodel classes used for the new Criteria API (see JSR 317 spec).

      [1] http://java.sun.com/javase/6/docs/api/javax/annotation/Generated.html

        Issue Links

          Activity

          Hide
          Witek Wołejszo added a comment -

          Hi,

          I've created jaxb generator extension that adds @Generated annotation to generated classes. Please see http://touk.pl/blog/2010/09/27/xjc-extension-generated/ for details.

          witek

          Show
          Witek Wołejszo added a comment - Hi, I've created jaxb generator extension that adds @Generated annotation to generated classes. Please see http://touk.pl/blog/2010/09/27/xjc-extension-generated/ for details. witek
          Hide
          Daniel Holmes added a comment -
          Show
          Daniel Holmes added a comment - I have created an issue for cobertura on the same https://sourceforge.net/tracker/?func=detail&aid=3323057&group_id=130558&atid=720018
          Hide
          Daniel Holmes added a comment -

          Someone on my team noted that this annotation is defined for only SOURCE retention, so tools that work on
          class files (Findbugs, Cobertura, etc) would not have this information available. I submitted to Oracle on this issue, but who knows if that would change. http://bugs.sun.com/bugdatabase/addVote.do?bug_id=7056857

          Show
          Daniel Holmes added a comment - Someone on my team noted that this annotation is defined for only SOURCE retention, so tools that work on class files (Findbugs, Cobertura, etc) would not have this information available. I submitted to Oracle on this issue, but who knows if that would change. http://bugs.sun.com/bugdatabase/addVote.do?bug_id=7056857
          Hide
          Evgeny Mandrikov added a comment -

          Hi Daniel,

          Your teammate is right : this annotation has retention policy source, which makes sense, because there is shouldn't be difference in runtime between generated and not generated code, so I don't think that Oracle will implement your request.

          Moreover I don't see compelling reasons why this annotation should be handled by underlaying tool, but not directly by Sonar - indeed Sonar works with source code and can completely ignore resource (violations, coverage, ...) when this annotation exists.

          Show
          Evgeny Mandrikov added a comment - Hi Daniel, Your teammate is right : this annotation has retention policy source , which makes sense, because there is shouldn't be difference in runtime between generated and not generated code, so I don't think that Oracle will implement your request. Moreover I don't see compelling reasons why this annotation should be handled by underlaying tool, but not directly by Sonar - indeed Sonar works with source code and can completely ignore resource (violations, coverage, ...) when this annotation exists.
          Hide
          Myster Mask added a comment - - edited

          This plugin:
          http://docs.codehaus.org/display/SONAR/Switch+Off+Violations+Plugin
          seems to support @Generated at file level (through regular expression matching). I have not used it so I can't tell how good this works.

          Show
          Myster Mask added a comment - - edited This plugin: http://docs.codehaus.org/display/SONAR/Switch+Off+Violations+Plugin seems to support @Generated at file level (through regular expression matching). I have not used it so I can't tell how good this works.

            People

            • Assignee:
              Unassigned
              Reporter:
              Julien HENRY
            • Votes:
              38 Vote for this issue
              Watchers:
              19 Start watching this issue

              Dates

              • Created:
                Updated: