0

I'm getting from Sonar a lot of these violations, but I think they are not really cycles.

So for example I have:

de.codeplumber.core.abc.core.Holder.java
de.codeplumber.core.xyz.core.User.java

The Holder.java uses User.java as one of the properties and has getter and setter for getting and setting the User object. Below is the code for Holder.java

private User user = new User();
public User getUser() {
    return user ;
}
public void setUser(User user) {
    this.user = user;
}

Now Sonar is reporting the violation in Holder.java

Remove the dependency on the source file "de/codeplumber/core/xyz/core/User.java" to break a package cycle.

There is no reverse dependency on the package to Holder.java from the package of User.java.

I am not understanding why sonar reports this issue. Previously I had the cyclic dependency in some other classes and i fixed it as there were direct cyclic dependency.

Any help appreciated.

Monish Das
  • 383
  • 2
  • 12
  • 28
  • Please share the relevant code for both classes, if you only show one side of the suspected cycle, we can't tell if there is one at all. – Mithfindel Mar 10 '15 at 08:20
  • There are few other getter setter which return/string in Holder.java and Name is just another value object class with getter and setter without any back reference to Holder.java package. I saw some other reference post in sonar site and there too there is no clear reply from them http://sonarqube.15.x6.nabble.com/squid-Avoid-cycle-between-java-packages-td5017551.html – Monish Das Mar 10 '15 at 14:18

0 Answers0