Skip to content

"release" parameter should only be set for javac version >= 9 #140

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

Closed
kwin opened this issue Jun 17, 2021 · 5 comments · Fixed by #362
Closed

"release" parameter should only be set for javac version >= 9 #140

kwin opened this issue Jun 17, 2021 · 5 comments · Fixed by #362

Comments

@kwin
Copy link
Contributor

kwin commented Jun 17, 2021

Sometimes it is difficult to set up the plugin configuration in a way to support different JDKs (maybe even using toolchains). For example look at MPOM-264. To ease that the JavacCompiler should only use the -release parameter with version 9 or above as using it with earlier versions leads to errors.

An additional condition should be added to

@rfscholte
Copy link
Member

This should be done at maven-compiler-plugin level, to ensure that every compiler implementation gets the same set of arguments. The more I think about it, the more it looks like https://issues.apache.org/jira/browse/MCOMPILER-270 from almost 5 years ago.
Reading the conclusion I still agree with myself: using the release flag should be a choice of the project, it should not be calculated as there are situation where you don't want to use the release flag. As long as the compiler supports source/target it must be possible to pass it as is.

@kwin
Copy link
Contributor Author

kwin commented Jun 17, 2021

IMHO plexus-compiler and m-compiler-p is a higher level abstraction and therefore should try to translate the intent of the parameter into the compiler specific flags. Release is clearly a parameter for javac >= 9 but does mot make sense for earlier versions nor for some other compilers.

@slachiewicz
Copy link
Member

a lot of code in JavacCompiler related to Java < 8 can be deleted

@rfscholte
Copy link
Member

a lot of code in JavacCompiler related to Java < 8 can be deleted

I don't think so. Keep in mind that you can still use toolchain, and best practice is to use the targeted JDK to compile.

@kwin
Copy link
Contributor Author

kwin commented Feb 1, 2024

There is already

which implements the same logic for parameter -source (only supported in javac 1.4 or newer) or for parameter -parameters.

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.

3 participants