SonarJava-71 Exclude issues on generated code when

2019-03-02 14:58发布

问题:

I see this https://jira.sonarsource.com/browse/SONARJAVA-71 improvement which the current status is closed. I was asked to raise my question here.

I would like to know how to implement the fix because i tried to use latest SonarJava 4.10.0.10260, however it still reports issues on class/methods with @generated annotation. Please advise how to implement this fix. Which version of SonarJava release this fix is included. Thanks!

回答1:

SONARAVA-71 has been implemented in version 4.9 of the SonarJava Analyzer, so your version of SonarJava should ignore such annotated elements if configured correctly.

Now, in order to have classes ans methods annotated with (and only with) @javax.annotation.Generated being ignored by the analyzer, be sure to provide the bytecode for your analysis.