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

LocalizedMessage should use ModuleName in compareTo method #4930

Closed
romani opened this issue Aug 10, 2017 · 6 comments
Closed

LocalizedMessage should use ModuleName in compareTo method #4930

romani opened this issue Aug 10, 2017 · 6 comments

Comments

@romani
Copy link
Member

romani commented Aug 10, 2017

base on discussion at #4899 (comment)

LocalizedMessage.compareTo use ModuleId but does not use ModuleName ..... strange, ModuleName should be used

@shashwatj07
Copy link
Contributor

I'm on it!

@romani
Copy link
Member Author

romani commented Apr 24, 2020

@shashwat70 ,

Are moduleName and moduleID both supposed to be used in the compareTo method?

yes. You meant sourceName instead moduleName.
We need both fields to be used in compare method.

we need to rename it to be moduleName to match naming convention with moduleId (could be done as separate issue, as it is API, we need to deprecate getSourceName method and keep it for some time before deletion).

shashwatj07 added a commit to shashwatj07/checkstyle that referenced this issue Apr 26, 2020
shashwatj07 added a commit to shashwatj07/checkstyle that referenced this issue Apr 27, 2020
shashwatj07 added a commit to shashwatj07/checkstyle that referenced this issue Apr 27, 2020
shashwatj07 added a commit to shashwatj07/checkstyle that referenced this issue Apr 27, 2020
shashwatj07 added a commit to shashwatj07/checkstyle that referenced this issue Apr 27, 2020
shashwatj07 added a commit to shashwatj07/checkstyle that referenced this issue Dec 3, 2020
@checkstyle checkstyle deleted a comment from shashwatj07 Mar 15, 2021
@checkstyle checkstyle deleted a comment from rnveach Mar 15, 2021
@checkstyle checkstyle deleted a comment from shashwatj07 Mar 15, 2021
@checkstyle checkstyle deleted a comment from shashwatj07 Mar 15, 2021
@romani
Copy link
Member Author

romani commented Mar 15, 2021

abandoned PR - #8192
everyone is welcome to reuse this code and send new PR to fix an issue.

@rnveach
Copy link
Member

rnveach commented Jan 22, 2023

LocalizedMessage

This is now in Violation.

LocalizedMessage.compareTo use ModuleId but does not use ModuleName ..... strange

Adding ModuleName (more technically sourceClass) to comparison will mean 2 different modules who print the same violation message will no longer be seen as same and each one will be unique. One good example is AbstractJavadocCheck#violateExecutionOnNonTightHtml.

Its odd all fields aren't used in compareTo but are used in hashCode and equals. The list: tokenType, severityLevel, key, bundle, sourceClass, customMessage, args . (Crossed out are part of violation message).

@romani
Copy link
Member Author

romani commented Mar 7, 2023

even change is in api package, I mark it as bug, as it is details of implementation.
There should be no any side effect or big change for users, just slightly more precise sorting in collections.

@github-actions github-actions bot added this to the 10.8.1 milestone Mar 7, 2023
@romani
Copy link
Member Author

romani commented Mar 7, 2023

Fix the s merged

@romani romani closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants