jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Sonar
  • SONAR-1042

Support for @Generated annotation

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Wish Wish
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Cobertura, Duplications, Findbugs, Java, Metrics, PMD, Rules, Source code viewer
  • Labels:
    None

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

depends upon

New Feature - A new feature of the product, which has yet to be developed. SONAR-1760 Support the annotation "@SuppressWarnings" at class and method level

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.
is related to

New Feature - A new feature of the product, which has yet to be developed. SONAR-2236 Skipping auto-generated files

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Freddy Mallet added a comment - 05/Aug/09 9:36 AM

Thanks for this information Julien !

Show
Freddy Mallet added a comment - 05/Aug/09 9:36 AM Thanks for this information Julien !
Hide
Permalink
Julien HENRY added a comment - 11/Aug/09 10:19 AM

I have opened a feature request on Axis2 JIRA: https://issues.apache.org/jira/browse/AXIS2-4462

Show
Julien HENRY added a comment - 11/Aug/09 10:19 AM I have opened a feature request on Axis2 JIRA: https://issues.apache.org/jira/browse/AXIS2-4462
Hide
Permalink
Julien HENRY added a comment - 11/Aug/09 10:23 AM

I have opened a feature request on Xmlbeans JIRA: http://issues.apache.org/jira/browse/XMLBEANS-413

Show
Julien HENRY added a comment - 11/Aug/09 10:23 AM I have opened a feature request on Xmlbeans JIRA: http://issues.apache.org/jira/browse/XMLBEANS-413
Hide
Permalink
Julien HENRY added a comment - 11/Aug/09 10:35 AM

I have added a feature request on Findbugs: https://sourceforge.net/tracker/?func=detail&aid=2835646&group_id=96405&atid=614696

Show
Julien HENRY added a comment - 11/Aug/09 10:35 AM I have added a feature request on Findbugs: https://sourceforge.net/tracker/?func=detail&aid=2835646&group_id=96405&atid=614696
Hide
Permalink
Julien HENRY added a comment - 11/Aug/09 10:51 AM

A request was already submitted for PMD: https://sourceforge.net/tracker/?func=detail&aid=2755562&group_id=56262&atid=479924

Show
Julien HENRY added a comment - 11/Aug/09 10:51 AM A request was already submitted for PMD: https://sourceforge.net/tracker/?func=detail&aid=2755562&group_id=56262&atid=479924
Hide
Permalink
Simon Brandhof added a comment - 11/Aug/09 6:18 PM

Nice job Julien !

Show
Simon Brandhof added a comment - 11/Aug/09 6:18 PM Nice job Julien !
Hide
Permalink
Julien HENRY added a comment - 12/Aug/09 2:18 AM

Thanks Simon.

Here is the link for Checkstyle: https://sourceforge.net/tracker/?func=detail&aid=2836054&group_id=29721&atid=397081

Show
Julien HENRY added a comment - 12/Aug/09 2:18 AM Thanks Simon. Here is the link for Checkstyle: https://sourceforge.net/tracker/?func=detail&aid=2836054&group_id=29721&atid=397081
Hide
Permalink
Witek Wołejszo added a comment - 27/Sep/10 4:28 PM

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 - 27/Sep/10 4:28 PM 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
Permalink
Daniel Holmes added a comment - 20/Jun/11 7:23 AM

I have created an issue for cobertura on the same https://sourceforge.net/tracker/?func=detail&aid=3323057&group_id=130558&atid=720018

Show
Daniel Holmes added a comment - 20/Jun/11 7:23 AM I have created an issue for cobertura on the same https://sourceforge.net/tracker/?func=detail&aid=3323057&group_id=130558&atid=720018
Hide
Permalink
Daniel Holmes added a comment - 20/Jun/11 8:37 AM

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 - 20/Jun/11 8:37 AM 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
Permalink
Evgeny Mandrikov added a comment - 20/Jun/11 8:59 AM

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 - 20/Jun/11 8:59 AM 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.

People

  • Assignee:
    Unassigned
    Reporter:
    Julien HENRY
Vote (20)
Watch (9)

Dates

  • Created:
    05/Aug/09 8:19 AM
    Updated:
    10/Jan/12 3:13 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.