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
new Check: ConstructorsDeclarationGrouping to check the grouping of overloaded constructors #14726
Labels
Milestone
Comments
I am good with proposal. @rnveach , @nrmancuso , please review to approve. |
@Zopsss please update example 6 to be compilable to make sure we are on the same page. |
I am good to approve |
Can you please review this issue? The other maintainers has approved this issue, We need your assurance as the final approval. And sorry for the ping, weekend is near so I thought the approval may get delayed |
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 1, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 6, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 6, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 6, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 6, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 8, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 8, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 8, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 8, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 9, 2024
3 tasks
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 9, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 10, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 10, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
Apr 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 3, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 3, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 4, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 7, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 7, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 7, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 9, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 9, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 9, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 9, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 10, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 14, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 17, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 17, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 18, 2024
Zopsss
added a commit
to Zopsss/checkstyle
that referenced
this issue
May 18, 2024
rnveach
pushed a commit
that referenced
this issue
May 20, 2024
Closes via #14844 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
initially discuses at #14415 and #14398
Reason of new check creation is desire to cover Google style request for this - #14273
I have downloaded the latest cli from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
How it works Now:
Checkstyle have a module called OverloadMethodsDeclarationOrder which checks that if the overloaded methods are grouped together or not, if there is another method between overloaded methods then it'll give you an error. Currently, in checkstyle there is no module to check the grouping of overloaded constructors in a class, enum, abstract class, records. This new module will check that the overloaded constructors are grouped together or not. If there is another method or anything else between the constructors ( expect comments ), it will give an error.
How I want check to work
Test.java
Expected output
The module should check the grouping of overloaded constructors and give an error if they don't follow the rule. It should give an error something like this:
Some other examples showing how the check should work
Example 1: This is fine
Example 2: This is fine as we do not required to have overloaded constructors in a specific order like in ascending order based on the number of parameters or something similar to that. We only care about that if the overloaded constructors are grouped together or not, we don't check their order based on number of parameters or anything.
Example 3: This will give error, constructors are not grouped together
Example 4: This is fine
Example 5: This will give error, constructors are not grouped together
Example 6: This is fine
Example 7: This will give error, constructors are not grouped together
Solution
The module should be able to verify that all overloaded constructors are grouped together in a class, enum, records, etc. The overloaded constructors should be strictly grouped together, if there is a method, variables, etc between them then it will give an error.
The text was updated successfully, but these errors were encountered: