Skip to content

[MCOMPILER-595] Enable parameter metadata by default - #1090

Closed
wilx wants to merge 1 commit into
apache:masterfrom
wilx:issue-858-parameters-by-default
Closed

[MCOMPILER-595] Enable parameter metadata by default#1090
wilx wants to merge 1 commit into
apache:masterfrom
wilx:issue-858-parameters-by-default

Conversation

@wilx

@wilx wilx commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Enable -parameters by default for both compiler:compile and compiler:testCompile.
  • Document that maven.compiler.parameters=false opts out of parameter-name metadata.
  • Extend the MCOMPILER-298 integration test to verify both the new default and the explicit opt-out.

Motivation

More frameworks rely on reflection to obtain method parameter names. Generating that metadata by default makes those names available without requiring every project to opt in explicitly, while retaining a configuration switch for projects that do not want the metadata.

Fixes #858

Validation

JAVA_HOME=/opt/jdks/latest-21 /opt/maven/latest-4/bin/mvn -ntp -Prun-its -Dinvoker.test=MCOMPILER-298 clean verify

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

Enable -parameters for compile and testCompile unless explicitly disabled. Extend MCOMPILER-298 to cover both the default and opt-out behavior.

Fixes apache#858
@wilx
wilx marked this pull request as ready for review July 28, 2026 16:17
@desruisseaux

Copy link
Copy Markdown
Contributor

In Maven 3, the Maven Compiler Plugin often overwrote the default options of the standard javac command with Maven's own opinion of what these defaults should be. The consequence was, for example, arbitrary and non-obvious default values for the -target option.

In the 4.x line of Maven Compiler Plugin, a design goal so far was to have the same defaults as the standard javac command. A javac option is not added unless explicitly requested, in an attempt to be less surprising for developers who read the Oracle javac man page. This pull request would be a first breach in this attempt to be consistent.

Given that the default value of this parameter can be set by the maven.compiler.parameters property, would it be okay for projects who want such default to specify it in a parent pom.xml?

@wilx

wilx commented Jul 28, 2026

Copy link
Copy Markdown
Contributor Author

While I have to enable it all the time for Spring Framework, I can deal with it. I saw the #858 and ran with it. I guess both the PR and the issue should be closed then.

@desruisseaux

Copy link
Copy Markdown
Contributor

Thanks. I'm closing this pull request on the basis of consistency with default behaviour of standard javac. I re-targeted #858 to 3.x since the 3.x line of the Compiler Plugin already has defaults that diverge from javac defaults. Therefore, maybe the question of whether to provide this default is still open for 3.x.

@desruisseaux desruisseaux self-assigned this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCOMPILER-595] Make -parameters enabled by default

2 participants