Skip to content

Preserve list-context MY::test overrides used by Thrift #1658

Closed

Description

@fglock

Summary

Preserve list-context MY::test overrides that call SUPER::test, as used by Thrift 0.22.0, and keep the generated Makefile valid.

Reproduction

Using the unchanged Thrift-0.22.0/Makefile.PL from its CPAN archive with the current PerlOnJava checkout:

package MY;
sub test {
    my @result;
    for (@result = shift->SUPER::test(@_)) {
        s/\$\(TEST_FILES\)/-Igen-perl -Igen-perl2 \$(TEST_FILES)/ig;
    }
    @result;
}

timeout 120 ./jperl Makefile.PL exits successfully, but the generated Makefile has no test target, omits both -Igen-perl and -Igen-perl2, and contains a bare 1 line after config:: pm_to_blib. make rejects that line with missing separator.

The current MakeMaker implementation assigns MY::test(...) in scalar context. Thrift's override returns the list from SUPER::test, so scalar context reduces the result to a count. The current installed SUPER::test stub also needs to provide the default test recipe for this customization to work.

Acceptance criteria

  • Invoke MY::test in the context expected by MakeMaker and preserve all returned rule lines.
  • A SUPER::test wrapper can modify $(TEST_FILES) and the generated Makefile contains the custom include paths.
  • The resulting Makefile parses with make, and its test target uses the generated Thrift modules.
  • Keep a regression test based on Thrift's actual override shape, including list return and SUPER::test.

Activity

  1. fglock commented on Oct 6, 2026

    @fglock
    OwnerAuthor

    Fixed by PR #1660. The permanent regression test uses Thrift’s list-returning override that modifies the SUPER::test rule, and verifies generated include paths, TEST_FILES, no stray scalar return, and valid Makefile syntax. The exact Thrift 0.22.0 archive now generates the expected test command; the test passes on JVM and interpreter backends.

  2. fglock commented on Nov 4, 2026

    @fglock
    OwnerAuthor

    Follow-up verification for the related scalar-context MY::test case:

    • CPAN run 20261104-113007-26634: Text::LineFold from Unicode-LineBreak 2019.001 generated a bare 2 in the Makefile because its MY::test wrapper calls SUPER::test in scalar context; make stopped with missing separator before PerlOnJava tests ran.
    • Added project regression test makemaker_scalar_my_test_super.t, which reproduces the scalar-context wrapper and verifies the generated test rule remains editable and parses.
    • The test passes on system Perl, PerlOnJava JVM and interpreter. Full make and current Ubuntu/Windows CI passed.
    • Fixed and merged in PR #1964.
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions