[ 
https://issues.apache.org/jira/browse/AVRO-3716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17809106#comment-17809106
 ] 

Niels Basjes edited comment on AVRO-3716 at 1/21/24 12:23 PM:
--------------------------------------------------------------

Some notes:
- Building with Unsafe under JDK 11/17/21 requires 
`--add-modules=jdk.unsupported` or it will fail. If you then set release=8 the 
build fails even faster because that is an illegal combination.
- So building with Unsafe support AND making the release version Java 8 can 
only be done by actually building it with Java 8.
- Testing under newer Java versions yields this problem 
https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/ 
which suggests using the release=8 ... but that is impossible because of the 
Unsafe ...

- So building under a newer JDK is needed for many reasons, yet the presence of 
Unsafe forbids it.

- Some tests need JavacTask ... which is a tools.jar system thing (very bad) 
that only works on Java 8.
- Some tests use Mockito which only works on Java 11+ ... which is a problem 
with the previous line.


Choices I have made so far:
- Drop the Unsafe completely, causes too much problems.
- Require the build (maven) to run under Java >17
- Build all code under the highest working JDK. This means toolchains 
supporting Java 8, 11, 17 and 21 MUST be installed.
- Do not do Matrix builds in GitHub. A matrix build REBUILDS the core software 
under the active JDK and this yields different results than testing the once 
build code with the tests under each JDK.
- So my WIP does all normal tests under all JDKs using the invoker plugin.



was (Author: nielsbasjes):
Some notes:
- Building with Unsafe under JDK 11/17/21 requires 
`--add-modules=jdk.unsupported` or it will fail. If you then set release=8 the 
build fails even faster because that is an illegal combination.
- So building with Unsafe support AND making the release version Java 8 can 
only be done by actually building it with Java 8.
- Some tests use Mockito which no longer supports Java 8. So the tests must run 
under Java 11+
- Testing under newer Java versions yields this problem 
https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/ 
which suggests using the release=8 ... but that is impossible because of the 
Unsafe ...

- So building under a newer JDK is needed for many reasons, yet the presence of 
Unsafe forbids it.

- Some tests need JavacTask ... which is a tools.jar system thing (very bad) 
that only works on Java 8.
- Some tests use Mockito which only works on Java 11+ ... which is a problem 
with the previous line.


Choices I have made so far:
- Drop the Unsafe completely, causes too much problems.
- Require the build (maven) to run under Java >17
- Build all code under the highest working JDK. This means toolchains 
supporting Java 8, 11, 17 and 21 MUST be installed.
- Do not do Matrix builds in GitHub. A matrix build REBUILDS the core software 
under the active JDK and this yields different results than testing the once 
build code with the tests under each JDK.
- So my WIP does all normal tests under all JDKs using the invoker plugin.


> Allow building with newer Maven plugins
> ---------------------------------------
>
>                 Key: AVRO-3716
>                 URL: https://issues.apache.org/jira/browse/AVRO-3716
>             Project: Apache Avro
>          Issue Type: Improvement
>            Reporter: Niels Basjes
>            Assignee: Niels Basjes
>            Priority: Major
>
> Several of the dependabot updates fail on Java 8 because of newer versions of 
> plugins needing Java 11 or Java 17 to run.
> {code:java}
> Warning:  Error injecting: 
> org.apache.maven.plugins.checkstyle.CheckstyleViolationCheckMojo 
> [206|https://github.com/apache/avro/actions/runs/4197990575/jobs/7281026269#step:7:207]java.lang.UnsupportedClassVersionError:
>  com/puppycrawl/tools/checkstyle/api/AuditListener has been compiled by a 
> more recent version of the Java Runtime (class file version 55.0), this 
> version of the Java Runtime only recognizes class file versions up to 
> 52.0{code}
> My proposal is to restructure the java maven build as follows:
> # The build requires Java 17 (or 11 if the next statement is incorrect)
> ## This means all plugins should work again.
> # The compiler must create Java 8 compatible classes (source=8, release=8)
> # To ensure it actually runs on all Java versions a basic set of tests are 
> executed with all LTS Java versions (8, 11 and 17) and the newest 
> intermediate (currently 19)
> #- Similar to what I have done here 
> #-- https://github.com/nielsbasjes/yauaa/blob/main/.github/workflows/build.yml
> #-- https://github.com/nielsbasjes/yauaa/tree/main/analyzer/src/it/JavaPlain
> #-- https://github.com/nielsbasjes/ToolChainsInCiBuilds
> Additional things
> - The build environment for developers change which requires updated  
> documentation and docker build.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to