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

[Core] Deprecate Formatter interface #1407

Merged
merged 7 commits into from
Jul 27, 2018
Merged

Conversation

mlvandijk
Copy link
Member

Summary

Deprecate Formatter marker interface

Details

Deprecate Formatter marker interface and replace all usages of Formatter with Plugin and EventListener.

Motivation and Context

Fixes #1401

How Has This Been Tested?

mvn clean install

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
    Not sure

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@coveralls
Copy link

coveralls commented Jun 28, 2018

Coverage Status

Coverage decreased (-0.006%) to 85.365% when pulling 2e5ee4a on deprecate-formatter into 8f15647 on master.

@@ -86,7 +86,7 @@ private void addPlugins(CucumberOptions options, List<String> args) {
for (String plugin : plugins) {
args.add("--plugin");
args.add(plugin);
if (PluginFactory.isFormatterName(plugin)) {
if (PluginFactory.isPluginName(plugin)) {
pluginSpecified = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this if statement can be removed. It connects to the null formatter. Before we were using events the null formatter was required because we had to call a method on some object. Now I believe this is no longer required.

See the Null_object_pattern.

Can you check if this is right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will try :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Removing the if statement, changes the result of RuntimeOptionsFactoryTest.create_null_formatter_when_no_formatter_plugin_is_defined() so that "cucumber.runtime.formatter.AnyStepDefinitionReporter" plugin is used, rather than "cucumber.runtime.formatter.NullFormatter".

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay. So now the null formatter is gone (replaced by no formatter), this test should be changed to check if no formatter is there instead.

*/
public interface ColorAware extends Formatter {
public interface ColorAware extends Plugin {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

Copy link
Member Author

Choose a reason for hiding this comment

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

\o/

*
* @see EventListener
* @see Plugin
* @deprecated as of version 4.0.0; use {@link Plugin } or {@link EventListener } instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this "or" or "and"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Should be both, although sometimes ColorAware and/or StrictAware instead of Plugin.

*/
public interface StrictAware extends Formatter {
public interface StrictAware extends Plugin {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you think it would be a good idea for all marker interfaces to extend from Plugin?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure what you mean; did I miss anything?

Copy link
Contributor

Choose a reason for hiding this comment

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

The EventListner I believe

Copy link
Member Author

Choose a reason for hiding this comment

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

EventListener is not a marker interface; it has a method: void setEventPublisher(EventPublisher publisher);

Copy link
Contributor

Choose a reason for hiding this comment

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

Good one.

Would it be a good idea to make EventListener extend from Plugin?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. (Updated)

@mpkorstanje mpkorstanje changed the title Deprecate Formatter interface (Fixes #1401) [Core] Deprecate Formatter interface Jun 29, 2018
@mpkorstanje mpkorstanje added this to the 4.0.0 milestone Jun 29, 2018
@mlvandijk
Copy link
Member Author

mlvandijk commented Jun 30, 2018

Some updates, based on review. Will need to look at first comment later.
A question of my own:

  • I've updated the Javadoc for ColorAware/StrictAware to mention plugins instead of formatters. Should names be updated elsewhere/everywhere? (i.e. package "formatter", several "SomethingFormatter" classes)?

@mpkorstanje
Copy link
Contributor

Ideally yes, but between parallel cukes and Aslak upgrading gherkin this will be painfull.

@mlvandijk
Copy link
Member Author

Ok, so let's do the renaming later (after those other PRs are merged?).

@mpkorstanje mpkorstanje merged commit c3d167f into master Jul 27, 2018
@mpkorstanje mpkorstanje deleted the deprecate-formatter branch July 27, 2018 13:13
@lock
Copy link

lock bot commented Jul 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] Deprecate the Formatter interface
3 participants