Repository navigation
Conversation
Both generate(Sink, Locale) and generate(Sink, SinkFactory, Locale) are default methods that delegate to each other. An implementation overriding neither recursed forever and failed with StackOverflowError during report generation. The multi-page generate(Sink, SinkFactory, Locale) now fails fast with a MavenReportException when neither overload is overridden, while still delegating to generate(Sink, Locale) for implementations that override it. Implementations overriding either overload keep working unchanged. Fixes #91
elharo
marked this pull request as draft
October 11, 2026 18:24
This comment was marked as off-topic.
This comment was marked as off-topic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
MavenReport.generate(Sink, Locale)andgenerate(Sink, SinkFactory, Locale)are bothdefaultmethods that delegate to each other. An implementation that overrides neither recurses forever and fails withStackOverflowErrorwhen a report is generated.Why
Because both overloads are
default, aMavenReportimplementation may override neither (the interface still requires the other abstract methods), so the recursion is reachable from ordinary report generation and crashes instead of reporting a clear error. See #91.How
The multi-page
generate(Sink, SinkFactory, Locale)now fails fast with aMavenReportExceptionwhen neither overload is overridden. It still delegates to the deprecatedgenerate(Sink, Locale)when that is overridden, so implementations overriding either overload keep working:generate(Sink, Locale)only -> multi-page call delegates to it with anullfactorygenerate(Sink, SinkFactory, Locale)only -> single-page call delegates to itMavenReportException, no recursionThe override check uses
getClass().getMethod("generate", Sink.class, Locale.class).isDefault(), which avoids changing either method's signature or default-ness.MavenReportExceptionis used (rather than an unchecked exception) so the failure flows through the existinggenerate(...)error handling.Tests
Added two tests to
MavenReportTestusing a report that overrides neither overload. Both fail withStackOverflowErrorbefore the fix and pass afterwards; the two pre-existing delegation tests guard the unchanged behavior.mvn verify(checkstyle, RAT, tests) passes.Fixes #91
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
check one of the following: