Skip to content

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

Closed

Description

@kwin

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

Activity

  1. rfscholte commented on Jun 17, 2021

    @rfscholte
    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.

  2. kwin commented on Jun 17, 2021

    @kwin
    ContributorAuthor

    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.

  3. slachiewicz commented on May 6, 2022

    @slachiewicz
    Member

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

  4. rfscholte commented on May 6, 2022

    @rfscholte
    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.

  5. kwin commented on Feb 1, 2024

    @kwin
    ContributorAuthor

    There is already

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

  6. added a commit that references this issue on Feb 3, 2024
    6949645
  7. added a commit that references this issue on Feb 5, 2024
    d8e98dd
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions