-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove calls to no-arg superclass constructor #3132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
There are other "rules" about empty blocks; our Sonar ruleset barks about them so an empty constructor is a violation of that rule. There is also the EmptyBlock checkstyle rule. We use The rule you cite seems bogus to me - if you look at the byte code generated, the compiler adds the same |
If you can make the rule only trigger if there is extra code in the constructor, it might then be useful. |
Thank you for reply.
Yeah, this is the reason why explicit call is redundant and goal of the check is to detect it. |
Well, I think we can change that |
More discussion here about possibly changing EmptyBlock to allow empty no-arg CTORs. |
OK. So, placing "on-hold" until a resolution for linked issue in Checkstyle. |
I checked this checkstyle rule and there is nothing about checking ctors. Can you please share checkstyle config that reports violation on empty ctor? |
Interesting - I see checkstyle doesn't complain about empty CTORs and I just ran a test with our current Sonar rules and that passed too So this must have been some old rule on an older Sonar installation that is no longer triggered. I therefore withdraw my objection. |
So, do we remove |
I would say so, yes (over time). |
Fixes spring-projects#3132 It turns out that Checkstyle EmptyBlock doesn't complain about empty default ctor. Plus a new check for `super();` call treats it as a violation * Remove `super();` from all the no-arg ctors * Code style clean up in the affected classes according IDEA suggestions
Fixes spring-projects#3132 It turns out that Checkstyle EmptyBlock doesn't complain about empty default ctor. Plus a new check for `super();` call treats it as a violation * Remove `super();` from all the no-arg ctors * Code style clean up in the affected classes according IDEA suggestions * Fix new Sonar smells
Fixes #3132 It turns out that Checkstyle EmptyBlock doesn't complain about empty default ctor. Plus a new check for `super();` call treats it as a violation * Remove `super();` from all the no-arg ctors * Code style clean up in the affected classes according IDEA suggestions * Fix new Sonar smells
Hi,
In checkstyle project we adding a new check to detect calls to no-arg superclass constructor
super();
checkstyle/checkstyle#7387
Our analysis shows that there are many violations of this check in your source code.
Analysis report:
https://strkkk.github.io/checkstyle/7363_3/spring-integration/index.html#A1
Can you please share your thoughts - it this calls should be removed or they can be kept for some reason?
Any feedback are appreciated.
The text was updated successfully, but these errors were encountered: