GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — High: mutual recursion between default generate() overloads causes StackOverflowError · Issue #91 · apache/maven-reporting-api

High: mutual recursion between default generate() overloads causes StackOverflowError #91

New issue
Copy link
New issue
Copy link
Closed
#96
Closed
High: mutual recursion between default generate() overloads causes StackOverflowError#91
#96
Copy link
Labels
bugSomething isn't working

Description

@elharo
elharo
opened on Oct 11, 2026
Issue body actions

Severity: High

Summary

The two generate(...) default methods in MavenReport delegate to each other. Because both are default, an implementation is allowed to override neither. Such an implementation compiles cleanly but recurses infinitely at runtime and crashes with StackOverflowError.

Location

src/main/java/org/apache/maven/reporting/MavenReport.java:60-62 and :76-78

@Deprecated
default void generate(Sink sink, Locale locale) throws MavenReportException {
    generate(sink, null, locale);          // -> multi-page overload
}

default void generate(Sink sink, SinkFactory sinkFactory, Locale locale) throws MavenReportException {
    generate(sink, locale);                // -> single-page overload
}

Impact

Any MavenReport implementation that overrides neither overload causes a StackOverflowError when the report is generated. This is a denial-of-service / crash for the Maven report runner. The previous contract made generate abstract, so this is a runtime regression introduced by making both methods default. The Javadoc states an implementation "must override at least one of them", but nothing enforces this at compile time or fails fast at runtime.

Steps to reproduce

  1. Implement MavenReport without overriding either generate(...) method.
  2. Call generate(sink, null, locale) (or generate(sink, locale)).
  3. Observe StackOverflowError.

Suggested fix

Make at least one of the methods non-default/abstract, or replace the default delegation with a fail-fast fallback, e.g.:

default void generate(Sink sink, SinkFactory sinkFactory, Locale locale) throws MavenReportException {
    throw new MavenReportException("This report does not implement generate(...)");
}

Test gap

MavenReportTest only covers implementations that override exactly one overload; it never exercises an implementation that overrides neither, which is the case that overflows.

Activity

  1. elharo
    added
    bugSomething isn't working
    on Oct 11, 2026
  2. slachiewicz
    added a commit that references this issue on Oct 18, 2026

    Make generate(Sink, Locale) abstract again

    c8dd302
  3. slachiewicz
    closed this as completedin #96on Oct 18, 2026
  4. slachiewicz
    added a commit that references this issue on Oct 18, 2026

    Make generate(Sink, Locale) abstract again

    7964c58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.