slachiewicz opened a new issue, #1111: URL: https://github.com/apache/maven-doxia/issues/1111
### Affected version 2.0.0 – 2.1.0, still on `master` ### Bug description `MarkdownParser.MarkdownHtmlParser` (the internal helper that turns Flexmark's HTML into Sink events) carries a bare `@Named`: https://github.com/apache/maven-doxia/blob/master/doxia-modules/doxia-module-markdown/src/main/java/org/apache/maven/doxia/module/markdown/MarkdownParser.java#L382-L383 Since it extends `Xhtml5Parser`, it is indexed in `META-INF/sisu/javax.inject.Named` and Sisu registers it as a `Parser` under its class name. So every `Map<String, Parser>` (including the one in `DefaultParserManager`) gets an extra entry next to the real parser ids: ``` apt, markdown, org.apache.maven.doxia.module.markdown.MarkdownParser$MarkdownHtmlParser, xdoc, xhtml ``` and `List<Parser>` contains it as well. I saw this with the Doxia 2.0.0 jars injected into a Maven mojo through `@Inject Map<String, Parser>`. Effects: - `ParserManager.getParser("org.apache.maven.doxia.module.markdown.MarkdownParser$MarkdownHtmlParser")` returns a parser that is not a real input format. - Code that lists the available parsers (for example to report the supported source formats) shows a bogus id. - The helper is an implementation detail of the Markdown module, but it leaks into the public set of `Parser` components. `@Named` is only there so that `MarkdownParser` can `@Inject` it (line 119). Possible fixes: - create it directly in `MarkdownParser` (`private final MarkdownHtmlParser parser = new MarkdownHtmlParser();`) and drop `@Named`/`@Inject`, or - keep the injection but not as a `Parser`, e.g. drop `@Named` and rely on a just-in-time binding of the concrete class. Related: #1110 gives the field a `new MarkdownHtmlParser()` default for the `ServiceLoader` path but keeps the `@Named`, and its test excludes the class from the Sisu index comparison. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
