[sonarjava][rules] FP on S1610 Abstract classes without fields should be converted to interfaces

52 views
Skip to first unread message

puret...@gmail.com

unread,
Feb 10, 2017, 8:11:08 PM2/10/17
to SonarQube
HI,
This rule reports issue for abstract class with private methods.

For example to refactor this class so it complies with rule:
 public abstract class Car {
    public void start() {
        turnOnLights();
        startEngine();
    }

    public abstract void stop();

    private void turnOnLights() {}
    private void startEngine() {}
}

i would have to make private methods public - undesired 
or make an inner class with those methods - ugly.

Pleas consider excluding abstract classes without fields but with private methods from this rule.

Best Regards
Piotr Pejas 

Michael Gumowski

unread,
Apr 6, 2017, 8:37:53 AM4/6/17
to puret...@gmail.com, SonarQube
Hey Priotr,

Sorry for the delay answering you, it seems that we missed your email. Anyway, thanks a lot for the feedback!
Indeed, in such cases, we should not raise an issue. I created the following ticket in order to fix it: SONARJAVA-2229

Interestingly, note that it will be possible to convert such abstract classes into interfaces with Java9, as private method in interface will be supported.

Regards,
Michael

--
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/4ecd0bd4-a83d-4244-86c0-5a0c8dbab657%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Michael GUMOWSKI | SonarSource
Software Developer @ Language Team
http://sonarsource.com
Reply all
Reply to author
Forward
0 new messages