Skip to content
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

Issue #14765: fix OverloadMethodsDeclarationOrderCheck #14766

Merged
merged 1 commit into from Apr 28, 2024

Conversation

Zopsss
Copy link
Contributor

@Zopsss Zopsss commented Apr 8, 2024

Issue #14765

  • Fixes OverloadMethodsDelcarationCheck. Now the module gives error when there is variable, interface, class, etc between overloaded methods.
  • Added new test cases
  • Updated Documentation

Diff Regression config: https://gist.githubusercontent.com/Zopsss/80b98438b46ad1111cf47c520e8ea669/raw/d98d1c801e2c5abd3e6e8834b749dbc95769db53/OverloadMethodsDeclarationOrderCheck.xml

Diff Regression projects: https://gist.githubusercontent.com/Zopsss/22adadb570e4deb95296917244c580b3/raw/29ea756eada8915637b76678db4f46048c198808/projects-to-test-on-for-github-action.properties

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 8, 2024

GitHub, generate site

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 8, 2024

GitHub, generate report

Copy link
Contributor

github-actions bot commented Apr 8, 2024

Report generation failed on phase "make_report",
step "Generate report".
Link: https://github.com/checkstyle/checkstyle/actions/runs/8595257615

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 8, 2024

GitHub, generate report

Copy link
Contributor

github-actions bot commented Apr 8, 2024

Report generation failed on phase "make_report",
step "Generate report".
Link: https://github.com/checkstyle/checkstyle/actions/runs/8595336634

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 8, 2024

GitHub, generate report

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 8, 2024

The website & report looks good to me.

@romani can you please review the PR?

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/ccc4bf1_2024074227/reports/diff/apache-ant/index.html#A1

All overloaded methods should be placed next to each other. Placing non-overloaded methods in between overloaded methods with the same type is a violation. Previous overloaded method located at line '1,234'.

Question to maintainers: Should we change message ?


@Zopsss , this looks like false positive - https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/ccc4bf1_2024074227/reports/diff/apache-struts/index.html#A5 , if that is true, please fix and regerate report and check report yourself first.

item:

@romani romani self-assigned this Apr 8, 2024
@Zopsss Zopsss force-pushed the method branch 2 times, most recently from 8a7c6d5 to 44b86fb Compare April 9, 2024 07:21
@romani
Copy link
Member

romani commented Apr 11, 2024

GitHub, generate website

Copy link
Member

@romani romani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok to merge.

@romani
Copy link
Member

romani commented Apr 13, 2024

GitHub, generate report

@romani romani assigned rnveach and unassigned romani Apr 13, 2024
@romani romani requested a review from rnveach April 13, 2024 20:01
@rnveach
Copy link
Member

rnveach commented Apr 16, 2024

@romani @nrmancuso @Zopsss
https://checkstyle-diff-reports.s3.us-east-2.amazonaws.com/1f7b5dc_2024204006/reports/diff/apache-struts/index.html#A1

Placing non-overloaded methods in between overloaded methods with the same type is a violation.

Shouldn't this verbiage be updated to something like Placing anything in between overloaded methods?

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 16, 2024

Placing anything in between overloaded methods

I guess following message will be a better option as we ignore the comments in this check:

Placing anything in between overloaded methods, expect comments

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 16, 2024

@romani
Copy link
Member

romani commented Apr 16, 2024

Failed CI is restarted

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 17, 2024

Failed CI is restarted

Thanks now all CIs are passing.

I've made the changes according to your suggestions, is there anything else left to do? @rnveach

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 18, 2024

Does this check have logic based on return type?

No the check does not care about the return type, it only cares about the method name.

Perhaps a better message would be Overloaded method declarations should be grouped together.

Can it be something like this?

Overloaded method declarations should be grouped together. Placing anything in between them is a violation, expect comment. Previous overloaded method is located at line '0'.

This message is shorter than the current error message and also simple & easy to understand.

@rnveach
Copy link
Member

rnveach commented Apr 20, 2024

@Zopsss We have come to a decision on new message.

Original message is All overloaded methods should be placed next to each other. Placing non-overloaded methods in between overloaded methods with the same type is a violation. Previous overloaded method located at line X.

New message is we trim message to just All overloaded methods should be placed next to each other. Previous overloaded method located at line X. So we basically remove the existing 2nd sentence.

Context of the 2nd sentence coming into existence:

bb2d8c1
#4921

It doesn't look like we will revert that issue with the proposed change. Original confusion was on the word "split" and we still don't use that in new change.

Copy link
Member

@rnveach rnveach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last change.

@rnveach
Copy link
Member

rnveach commented Apr 20, 2024

I am good with code and regression besides my last item.

@Zopsss Zopsss force-pushed the method branch 2 times, most recently from 8dabbb4 to 28743fe Compare April 20, 2024 18:53
@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 20, 2024

My IntelliJ automatically added unicodes to the translated messages.. fixing this asap. Idk why this happened. So sorry for this

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 20, 2024

Updated the xdoc examples and resolved the failing CIs.

PR is now ready to be merged. Sorry it took a little longer, my IntelliJ was not working properly idk why that happened.

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 22, 2024

@rnveach

@rnveach rnveach assigned nrmancuso and unassigned rnveach Apr 24, 2024
@MANISH-K-07
Copy link
Contributor

MANISH-K-07 commented Apr 26, 2024

My IntelliJ automatically added unicodes to the translated messages.. fixing this asap. Idk why this happened.

PR is now ready to be merged. Sorry it took a little longer, my IntelliJ was not working properly idk why that happened.

@Zopsss , not just IntelliJ, IDEs in general are not automatically configured to detect these.
It is better to use primitive editors for properties files to avoid such unwanted changes..

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 26, 2024

@Zopsss , not just IntelliJ, IDEs in general are not automatically configured to detect these. It is better to use primitive editors for properties files to avoid such unwanted changes..

Okkay got it! Thanks for the help.

@Zopsss
Copy link
Contributor Author

Zopsss commented Apr 26, 2024

@nrmancuso can you merge the PR please? Other maintainers have approved the changes.

@nrmancuso
Copy link
Member

Good stuff @Zopsss !

@nrmancuso nrmancuso merged commit 4096711 into checkstyle:master Apr 28, 2024
113 checks passed
@Zopsss Zopsss deleted the method branch April 28, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants