We are using SonarQube 9.7.1.62043
We get erro java:S2440 → Classes with only “static” methods should not be instantiated, but it’s referring to android.graphics.Canvas or android.graphics. Paint and we don’t know why. Both classes have a lot of non-static methods and we don’t know why it happened.
An example of the code is:
private void init() {
paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setStyle(Paint.Style.FILL);
Hi Ryszard,
I was able to find a false-positives of java:S2440 with generic class inheritance, so I created this ticket: SONARJAVA-4404
But I have too few code from your false-positive to be sure it is related. For this, I would need a reproducer extracted from your code. (inherited class/interface are needed, method body can be empty or return null, 1 or 2 methods/fields per class should be enough to reproduce).