In my application we are using OpenJpa. By decompiling my classes, I can see some methods I haven´t typed, for instance pcGetid:

public long getId()
  {
    return pcGetid(this);
  }
  (...)
  private static final long pcGetid(...)

My original java file looks like:

public long getId() {
        return id;
    }

I assume that is some internal OpenJpa procedure. The problem comes when Sonar analyzes my code. Many Unused private method major violations appears, because some of those methods are not used. Is ther a way to ignore sonar in these cases? I can not use //NOSONAR because in my code those methods does not exist.

It might be usefull to know in which phase of the build process this methods are added, so I can analyze the content before it happens.

Any idea would be appreciated!

Thanks

有帮助吗?

解决方案

If you're using SonarQube 4.0, you can use the issue exclusion mechanism to exclude all issues on this "Unused private method" for a set of java files :http://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-patterns

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top