GeezerVison is showing github.com — [MSHARED-1364] AbstractMavenReportRenderer should not depend on Doxia impl classes · Issue #184 · apache/maven-reporting-impl
[MSHARED-1364] AbstractMavenReportRenderer should not depend on Doxia impl classes #184DescriptionKonrad Windszus opened MSHARED-1364 and commented
The classes in package o.a.m.doxia.sink.impl should by definition not be considered stable API (and therefore only consumed from Doxia classes internally).
However https://github.com/apache/maven-reporting-impl/blob/72181306bb0e12eed50c4ba4aec98dd76499df39/src/main/java/org/apache/maven/reporting/AbstractMavenReportRenderer.java#L47 depends on some internal constants.
This is dangerous, as those constants were removed in the context of DOXIA-685. Although constants are inlined during compile time, the evaluation of those constants vanished as well, so using them has no longer any effect. Reporting Impl should only rely on stable Doxia API to achieve a better decoupling.
Affects: maven-reporting-impl-4.0.0-M13 Activityjira-importer commented on Mar 16, 2024 Michael Osipov commented
What do you recommend to do in such a case? Where should this class (SinkEventAttributeSet) be? jira-importer commented on Mar 16, 2024 jira-importer commented on Mar 16, 2024 Michael Osipov commented
I see and then extend from to retain binary compat? If so, please create a ticket and do so. slachiewicz commented on Aug 22, 2025 @kwin do You think it's worth to work on it? slachiewicz commented on Aug 8, 2026 Filed the Doxia ticket Michael asked for back in 2024, and drafted the change: apache/maven-doxia#1072, PR apache/maven-doxia#1073.
A few things that came out of looking into this:
The scope here is now one line. sink.verbatim(SinkEventAttributeSet.SOURCE) in verbatimSource() is the only reference to org.apache.maven.doxia.sink.impl left in this component. MSHARED-1182 dropped the BOXED usage and MSHARED-1185 added verbatimSource(), so this has been the whole of it for a while.
This component cannot fix it on its own. doxia-sink-api has six files in it and ships no implementation of SinkEventAttributes and no factory for one, so Sink.verbatim(SinkEventAttributes) is uncallable by anyone without reaching into doxia-core's impl package. That is why the fix has to be on the Doxia side.
It is not this component's doing either. In a checkout of the Maven repositories, 14 files import that package: maven-project-info-reports-plugin, maven-changes-plugin, maven-pmd-plugin, maven-plugin-report-plugin, maven-surefire-report-plugin, dist-tool and this one. And the class was in org.apache.maven.doxia.sink until DOXIA-506 moved it in with the internal sink implementations, so it is a class consumers always used that got relabelled as internal, not one they reached into.
One correction to the original report. It says the constants lost their effect when DOXIA-685 replaced BOXED with SOURCE. That is not true of SOURCE today: Xhtml5BaseSink.verbatim(SinkEventAttributes) in 2.1.0 still evaluates DECORATION and emits <pre><code> for it, and src/it/use-as-direct-mojo asserts exactly that output. So there is no behavioural bug to fix here, only the package dependency.
Once the Doxia change is released this becomes a one-line import change. slachiewicz commented on Aug 8, 2026 Recording the exact remaining work here, so this issue is self-contained once the Doxia side lands.
Blocked on: apache/maven-doxia#1073, which moves SinkEventAttributeSet into doxia-sink-api. Targeted at Doxia 2.2.0.
When Doxia 2.2.0 is released, this is finished by bumping doxiaVersion and changing one import in AbstractMavenReportRenderer:
-import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
+import org.apache.maven.doxia.sink.SinkEventAttributeSet;
The single use is sink.verbatim(SinkEventAttributeSet.SOURCE) in verbatimSource(), and it is the only reference to org.apache.maven.doxia.sink.impl left in this component. The constants are the same objects under either name, so nothing else changes.
Worth doing at the same time, and arguably more urgent than the package hygiene: SinkEventAttributeSet.SOURCE does not exist in Doxia 1, where it is called BOXED. Since a report plugin renders with whatever Doxia the Maven Site Plugin provides, verbatimSource() fails with a NoSuchFieldError under any Site Plugin older than 3.21.0 — the same failure mode as apache/maven-project-info-reports-plugin#103, which #243 has just fixed for verbatimText/verbatimLink. maven-plugin-report-plugin calls verbatimSource(), so this is reachable in practice, not hypothetical.
Moving the class does not fix that on its own: SOURCE versus BOXED is a Doxia 1 versus 2 difference, not a packaging one. slachiewicz commented on Aug 8, 2026 Reopened: this was closed automatically when #245 merged, not deliberately. The PR body said "does not resolve #184", and GitHub matched the resolve #184 part of that regardless of the negation. Wording corrected there so it does not happen again.
Still open as described above: waiting on apache/maven-doxia#1073, then a one line import change here.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|