Hi maven-dev,

I am trying to use the JEP 118 "-parameters" compile flag which bundles
method parameter names into class metadata for access at runtime.

I would like to enable this in our corporate parent POM, which
configures the compiler plugin.  Per documentation, I could add

<compilerArgs>
  <arg>-parameters</arg>
</compilerArgs>

Unfortunately, this is new in Java 1.8 -- so any project that does not
target 1.8 cannot use this option.

Since we use toolchains to compile some 1.6 code, we would have to enable
this argument only for 1.8 projects.  Would be a great use for a Maven
profile, but unfortunately my understanding is profile activation only
triggers on the *JDK used to invoke Maven*, not the *toolchain JDK* -- in
our case the former will be 1.8, the latter 1.6, and then you end up
with unknown compiler arguments.

This sucks!

Aside from griping about how inflexible profiles are, and how difficult it
is to manage compiler arguments in a heterogeneous environment, I think it
would be useful to introduce a CompilerConfiguration boolean for parameter 
names.

The pull request would likely look similar to:
https://github.com/codehaus-plexus/plexus-compiler/pull/14

It would add the "-parameters" flag only if the *toolchain* JDK supports it,
otherwise it would be a noop (and maybe a warning?)

Then, there would be a separate patch to maven-compiler-plugin to use the new
plexus-compiler and expose the argument to the POM configuration.

Is this a good approach?  Would such a PR get merged?  Have I missed anything 
obvious?

Thanks,
Steven Schlansker


Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to