Skip to content

CONFLUENCE-240: Make AbstractMacroConverter and the Confluence Converter public #70

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

raphj
Copy link
Contributor

@raphj raphj commented Apr 8, 2025

I'm preparing to document various things on the confluence package. Before I can do this, some things need to be cleaned up so we don't document shit, and in particular this means addressing CONFLUENCE-240: we now want external projects to be able to write macro converters, and this means making AbstractMacroConverter and the Confluence reference converter public and not internal.

I also want to deprecate toParameterName and toParameterValue, as we now want to better control what parameters get passed when converting macros. We don't want confluence parameters to leak by default anymore because it may cause compatibility issues later (it's still a good strategy for bridges, but this is handled by DefaultMacroConverter, custom macro converters don't need this)

Please let me know if you see something wrong with this.

I also wanted to deprecate using ConfluenceURLConverter from the XHTML package directly as a role and move the role in confluence-xml as a separate, dedicated, interface, because fundamentally implementers of URL converters should not care about the specific Confluence syntax that is used, but didn't manage to do this cleanly without breaking backward compatibility, and I guess it doesn't matter too much in practice.

Assigning a few people who have been dealing with macro converters for review but feel free to ignore. It might be the best occasion to address some pain points you might have encountered as we are introducing a new interface and can amend a few things without breaking stuff.

raphj added 5 commits April 8, 2025 09:14
…ter public

* Introduce the public AbstractMacroConverter class
…ter public

* Make most macro converters use the new class
…ter public

 * Make a public ConfluenceFilterReferenceConverter interface in Confluence-XML
 * Make ConfluenceConverter an implementer of this interface
…ter public

 * Make most things use ConfluenceFilterReferenceConverter instead of ConfluenceConverter
…ter public

* Mark ConfluenceConverter as deprecated so IDEs can warn against injecting it
/**
* Base class for {@link MacroConverter} implementations.
* @version $Id$
* @since 9.82.0
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be something like 9.83.0 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make sure the since annotations are up to date when I merge this


private void warnCantMark()
{
logger.error(
Copy link
Member

Choose a reason for hiding this comment

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

The method name suggest the intent is .warn, but maybe the method name is wrong ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed. I'll rename this to logCantMarkError or something like this

/**
* @param name the name to validate
* @return the validated name
* @since 9.26.0
Copy link
Member

Choose a reason for hiding this comment

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

The @since from the methods don't really make much sense anymore, since they are lower than the class's @since.

@Singleton
public class ConfluenceConverter implements ConfluenceReferenceConverter
@Deprecated (since = "9.83.0")
Copy link
Member

Choose a reason for hiding this comment

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

Do you need to keep this component since it's internal ? Don't want to fix all the code that calls it just yet ?

Copy link
Contributor Author

@raphj raphj Apr 10, 2025

Choose a reason for hiding this comment

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

@tmortagne that's the tricky part

  • We need this component as it's the implementation of ConfluenceReferenceConverter, so we need to keep it. We could rename it to DefaultConfluenceReferenceConverter, but...
  • This component has been injected in other projects providing macro converters (including code we don't control). That's my mystake of not handling CONFLUENCE-240 earlier. I would like to not break them (now is a very bad time for this) and leave a few months of transition as things settle, after which we can rename ConfluenceConverter to DefaultConfluenceReferenceConverter and remove the deprecated annotation

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.

5 participants