Hi,
We have a parent class which is defined in a 3rd party library. It defines a "clone" method but does not implement the "Cloneable" interface.
Next, we have our class which extends that class and implements "Cloneable". We don't introduce any new fields, so "clone" method defined in parent class provides all required logic.
Unfortunately, SonarQube reported an issue that our class requires "clone" method. If we add "clone" method which delegates all logic to the parent, then we hit another problem: S1185 - Overriding methods should do more than simply call the same method in the super class.
Code:

Environment:
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/DB6PR0801MB12879C4910281B60A4191616980E0%40DB6PR0801MB1287.eurprd08.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
Hello Michael,
I agree with the opinion that forced the implementation is not a bad thing.
public class Foo implements Cloneable {
// ...
@Override
public Foo clone() {
try {
return (Foo) super.clone();
} catch (CloneNotSupportedException e) {
// never
throw new IllegalStateException(e);
}
}
}
But it is not very popular, so it would be great if you could extends the rule specification (RSPEC-1185). I don't like to mark issues as Won't Fix ;-)
Cheers,
Adam Gabryś