Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-25465

Use javac --release option for supporting cross version compilation

    XMLWordPrintableJSON

Details

    • Reviewed
    • Hide
      When compiling with java 11 and above, we will use --release 8 to maintain java 8 compatibility.
      Also upgrade jackson to 2.13.1 because in hbase-thirdparty 4.1.0 we shade jackson 2.13.1.
      Show
      When compiling with java 11 and above, we will use --release 8 to maintain java 8 compatibility. Also upgrade jackson to 2.13.1 because in hbase-thirdparty 4.1.0 we shade jackson 2.13.1.

    Description

      See https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/

      the Java compiler’s --release parameter, which was introduced via JEP 247 ("Compile for Older Platform Versions"), added to the platform also in JDK 9. In contrast to the more widely known pair of --source and --target, the --release switch will ensure that only byte code is produced which actually will be usable with the specified Java version. For this purpose, the JDK contains the signature data for all supported Java versions (stored in the $JAVA_HOME/lib/ct.sym file).

      Using one JDK (i.e. Java 11) to build Java 8-and-up and Java 11-and-up compatible release artifacts would reduce some sources of accidental complexity, assuming the --release parameter actually works as advertised. To produce Java 8-and-up compatible artifacts, supply --release=8. To produce Java 11-and-up compatible release artifacts, supply --release=11. Maven activations based on JDK version and command line defined profiles can control what --release parameter, if any, should be passed to the compiler.

      Attachments

        Issue Links

          Activity

            People

              zhangduo Duo Zhang
              apurtell Andrew Kyle Purtell
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: