Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect semantics of JavacCompiler.isPreJavaXX #356

Closed
kwin opened this issue Feb 1, 2024 · 1 comment · Fixed by #357
Closed

Incorrect semantics of JavacCompiler.isPreJavaXX #356

kwin opened this issue Feb 1, 2024 · 1 comment · Fixed by #357

Comments

@kwin
Copy link
Contributor

kwin commented Feb 1, 2024

According to the javadoc of

and the methods isPreJavaXX are supposed to

return true if the compiler configuration represents a Java XX compiler or later, false otherwise

The logic within those methods evaluates partially also the parameter source (

) or release ( ) which are completely orthogonal to the javac version being used. They only determine the bytecode version being generated but have nothing to do with the version of the compiler itself.

However I am not sure when CompilerConfiguration.getCompilerVersion() is reliably set at all. IMHO there should be some logic separate for in-process and forked compiling which determines the real javac version (either from system property java.version for in-process compilation or the parsed output of javac -version)

@kwin
Copy link
Contributor Author

kwin commented Feb 1, 2024

Actually the CompilerConfiguration.getCompilerVersion only exposes what is set via https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#compilerVersion so this does not necessarily reflect the actual javac version either. The deprecation of that parameter is tracked in https://issues.apache.org/jira/browse/MCOMPILER-573.

kwin added a commit that referenced this issue Feb 1, 2024
Ignore CompilerConfiguration values as they are unreliable (and don't
represent the used javac version)
Make test execution more resilient by interpolating settings.xml
correctly and make sure commons-lang 2.0 is resolved prior to unit
testing

This closes #356
kwin added a commit that referenced this issue Feb 1, 2024
Ignore CompilerConfiguration values as they are unreliable (and don't
represent the used javac version)
Make test execution more resilient by interpolating settings.xml
correctly and make sure commons-lang 2.0 is resolved prior to unit
testing

This closes #356
@kwin kwin closed this as completed in #357 Feb 3, 2024
kwin added a commit that referenced this issue Feb 3, 2024
Ignore and deprecate CompilerConfiguration values as they are unreliable (and don't
represent the used javac version)

Make test execution more resilient by interpolating settings.xml
correctly and make sure commons-lang 2.0 is resolved prior to unit
testing

This closes #356
kwin added a commit to apache/maven-compiler-plugin that referenced this issue Feb 24, 2024
This is no longer evaluated in plexus-compiler-javac
(codehaus-plexus/plexus-compiler#356).
It was never used by any other plexus compilers in the past.
kwin added a commit to apache/maven-compiler-plugin that referenced this issue Feb 24, 2024
This is no longer evaluated in plexus-compiler-javac
(codehaus-plexus/plexus-compiler#356).
It was never used by any other plexus compilers in the past.
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 a pull request may close this issue.

1 participant