When having the below 2 classes, Teamscale tells me at least the code fragment ranging from private final int a; until the last } in the second if statement of the equals method are definetly duplicates. In SonarQube it tells me there is no duplication at all. Why is it like that?
I read up on the topic but could not find that much detailed docs, it states a fragment has to have at least 10 duplicated statements to be recognized as duplicate. What does count as a statement? When I count in the Methodheads it is more than 10 otherwise less than 10. Can I adjust this value? Also can I adjust this value for a specific package without changing it for others?
public class A
{
private final int a;
public A(final int a)
{
this.a = a;
}
public int getA()
{
return a;
}
@Override
public boolean equals(Object other)
{
if (other == null)
{
return false;
}
if (this.getClass() != other.getClass())
{
return false;
}
A otherA = (A) other;
return a == otherA.a;
}
}
public class B{
private final int b;
public B(final int b)
{
this.b = b;
}
public int getB()
{
return b;
}
@Override
public boolean equals(Object other)
{
if (other == null)
{
return false;
}
if (this.getClass() != other.getClass())
{
return false;
}
B otherB = (B) other;
return b == otherB.b;
}
}