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 #3544: cleaned API methods related to MessageDispatcher & Renamed to ViolationDispatcher #14687
base: master
Are you sure you want to change the base?
Conversation
import com.puppycrawl.tools.checkstyle.api.RootModule; | ||
import com.puppycrawl.tools.checkstyle.api.SeverityLevel; | ||
import com.puppycrawl.tools.checkstyle.api.SeverityLevelCounter; | ||
import com.puppycrawl.tools.checkstyle.api.Violation; | ||
import com.puppycrawl.tools.checkstyle.api.ViolationDispatcher; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this interface seats in the api package, should we go via deprecation process first, so we introduce a new interface but still keep the old one marked as deprecated? Otherwise, this PR may contain breaking changes. @romani what are your thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we need to think on deprecation first. To let all plugins to migrate first, and if no known tools left, do deletion.
Is it possible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Items
@@ -24,7 +24,7 @@ | |||
/** | |||
* Used by FileSetChecks to distribute AuditEvents to AuditListeners. | |||
*/ | |||
public interface MessageDispatcher { | |||
public interface ViolationDispatcher { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This by fact, new class.
This good opportunity to make it with better design.
Major concerns on void fireErrors(String fileName, SortedSet<Violation> errors);
Name of method is not good. Should be fireViolations
or similar.
@rdiachenko , what would you recommend?
We can change all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rdiachenko , ping please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public interface ViolationDispatcher{
void fireFileStarted(String fileName);
void fireFileFinished(String fileName);
void fireErrors(String fileName, SortedSet<Violation> errors);
}
Name of class and method becomes weird. Before update it was also not good, but it was too abstract it was less a concern, MessageDispatcher
.
Problem is that we mixing fireFileXxxx
with fireViolation
and call it ViolationDispatrer, that is good name if only fireViolation
be in interface.
May be we should just rename method in this interface to fireViolation
and name of class EventDispatcher
. Do we have any EventXxxx in our code base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can not use Event word.
@romani , this PR is already outdated by 2 weeks. So, how do you suggest we finish this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rdiachenko , is there any suggestion on api naming and structure ?
@nrmancuso , @rnveach , please share your opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we first need confirmation we are breaking compatibility with this issue and PR. We are renaming an interface that sits in the API class. I am also not seeing any deprecation in this PR as issue states.
If we are breaking compatibility, then issues needs label.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we put labels after a fix, if we agree on fix, label is just reflection.
I am ok to break compatibility if we got better api that is easier to understand. For now I do not see that we improving.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should consider https://docs.oracle.com/en/java/javase/21/docs/api/java.desktop/java/beans/PropertyChangeListener.html?
Part of #3544
Renamed MessageDispatcher -->
ViolationDispatcher
Cleaned up all related methods.