diff --git a/.github/workflows/codeql-java-analysis.yml b/.github/workflows/codeql-java-analysis.yml
index 2ca8ef9356e..e53141e1e3f 100644
--- a/.github/workflows/codeql-java-analysis.yml
+++ b/.github/workflows/codeql-java-analysis.yml
@@ -70,10 +70,25 @@ jobs:
# queries: ./path/to/local/query, your-org/your-repo/queries@main
queries: +security-and-quality
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- - name: Autobuild
- uses: github/codeql-action/autobuild@v3
+# - name: Autobuild
+# uses: github/codeql-action/autobuild@v3
# âšī¸ Command-line programs to run using the OS shell.
# đ https://git.io/JvXDl
@@ -81,6 +96,8 @@ jobs:
# âī¸ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
+ - name: 'Java Test'
+ run: mvn clean test
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
diff --git a/.github/workflows/java-publish-snapshot.yml b/.github/workflows/java-publish-snapshot.yml
index 2e13aae3844..af610bda96f 100644
--- a/.github/workflows/java-publish-snapshot.yml
+++ b/.github/workflows/java-publish-snapshot.yml
@@ -47,16 +47,25 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- - name: Setup Java
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
- distribution: 'adopt'
- java-version: 8
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
- - name: Deploy Maven snapshots
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
+ - name: 'Deploy Maven snapshots'
env:
ASF_USERNAME: ${{ secrets.NEXUS_USER }}
ASF_PASSWORD: ${{ secrets.NEXUS_PW }}
run: |
echo "apache.snapshots.https$ASF_USERNAME$ASF_PASSWORD" > settings.xml
- mvn --settings settings.xml -U -B -e -fae -ntp -DskipTests deploy
+ mvn --settings settings.xml -U -B -e -fae -ntp -PskipQuality deploy
diff --git a/.github/workflows/maven4.yml b/.github/workflows/maven4.yml
index 8ebd7e93ae9..61259ce7723 100644
--- a/.github/workflows/maven4.yml
+++ b/.github/workflows/maven4.yml
@@ -50,16 +50,20 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-build-cache
- - name: Setup Java
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
- distribution: 'adopt'
- java-version: '11'
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
- name: Setup Maven 4
- uses: stCarolas/setup-maven@v4.5
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
with:
- maven-version: 4.0.0-alpha-4
+ maven-version: 4.0.0-alpha-10
- name: Test
- run: mvn clean package
+ run: mvn clean verify
diff --git a/.github/workflows/rat.yml b/.github/workflows/rat.yml
index fc061678dea..b56acb27955 100644
--- a/.github/workflows/rat.yml
+++ b/.github/workflows/rat.yml
@@ -39,11 +39,20 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- - name: Setup Java
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
- distribution: 'adopt'
- java-version: '11'
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
- name: Run Rat
- run: mvn test -Dmaven.main.skip=true -Dmaven.test.skip=true -DskipTests=true -P rat -pl :avro-toplevel
+ run: mvn test -Dmaven.main.skip=true -Dmaven.test.skip=true -DskipTests=true -Dinvoker.skip=true -P rat -pl :avro-toplevel
diff --git a/.github/workflows/spotless.yml b/.github/workflows/spotless.yml
index 5e8515cf5f9..6c5c4d36294 100644
--- a/.github/workflows/spotless.yml
+++ b/.github/workflows/spotless.yml
@@ -42,11 +42,20 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- - name: Setup Java
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
- distribution: 'adopt'
- java-version: '11'
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
- name: Run Spotless Check
run: mvn spotless:check
diff --git a/.github/workflows/test-lang-c.yml b/.github/workflows/test-lang-c.yml
index eaeaa1f945c..52fd902c073 100644
--- a/.github/workflows/test-lang-c.yml
+++ b/.github/workflows/test-lang-c.yml
@@ -63,9 +63,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
@@ -102,9 +117,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
diff --git a/.github/workflows/test-lang-csharp.yml b/.github/workflows/test-lang-csharp.yml
index 50f397beeb7..b846072289e 100644
--- a/.github/workflows/test-lang-csharp.yml
+++ b/.github/workflows/test-lang-csharp.yml
@@ -92,9 +92,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
diff --git a/.github/workflows/test-lang-java.yml b/.github/workflows/test-lang-java.yml
index 8393d439b37..2fb09640893 100644
--- a/.github/workflows/test-lang-java.yml
+++ b/.github/workflows/test-lang-java.yml
@@ -35,54 +35,57 @@ concurrency:
jobs:
test:
- name: Java ${{ matrix.java }} Test
+ name: 'Java Test'
runs-on: ubuntu-latest
- strategy:
- matrix:
- java:
- - '8'
- - '11'
- - '17'
- - '21'
- - '22-ea'
steps:
- - uses: actions/checkout@v4
+ - name: 'Checkout sourcecode'
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- - name: Cache Local Maven Repository
- uses: actions/cache@v4
+ - name: 'Cache Local Maven Repository'
+ uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- - name: Setup Temurin JDK
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'temurin'
- java-version: ${{ matrix.java }}
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
- - name: Lint
+ - name: 'Java Lint'
run: ./build.sh lint
- - name: Test
+ - name: 'Java Test'
run: ./build.sh test
+ - name: 'Install Java Avro for reproducibility test'
+ working-directory: .
+ run: mvn -B clean install -PskipQuality
+
+ - name: 'Test Reproducible Build'
+ working-directory: .
+ run: mvn clean verify -PskipQuality artifact:compare
+
interop:
- name: Java ${{ matrix.java }} Interop
+ name: 'Java Interop'
runs-on: ubuntu-latest
- strategy:
- matrix:
- java:
- - '8'
- - '11'
- - '17'
- - '21'
- - '22-ea'
+
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- - name: Cache Local Maven Repository
+ - name: 'Cache Local Maven Repository'
uses: actions/cache@v4
with:
path: ~/.m2/repository
@@ -90,28 +93,37 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
- - name: Setup Java
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'temurin'
- java-version: ${{ matrix.java }}
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
- - name: Setup Python for Generating Input Data
- uses: actions/setup-python@v5
+ - name: 'Setup Python for Generating Input Data'
+ uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0
- - name: Apt Install Compression Libs Required by Python
+ - name: 'Apt Install Compression Libs Required by Python'
run: |
sudo apt-get install -qqy --no-install-recommends libbz2-dev \
liblzma-dev \
libsnappy-dev \
libzstd-dev
- - name: Install Python Dependencies
+ - name: 'Install Python Dependencies'
run: |
python3 -m pip install --upgrade pip setuptools tox
python3 -m pip install python-snappy zstandard
- - name: Setup C# for Generating Interop Data
+ - name: 'Setup C# for Generating Interop Data'
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
@@ -121,65 +133,70 @@ jobs:
7.0.x
8.0.x
- - name: Install Java Avro for Interop Test
- working-directory: .
- run: mvn -B install -DskipTests
-
- - name: Create Interop Data Directory
+ - name: 'Create Interop Data Directory'
working-directory: .
run: mkdir -p build/interop/data
- - name: Generate Interop Resources
- working-directory: lang/java/avro
- run: mvn -B -P interop-data-generate generate-resources
-
- - name: Generate Interop Data using Python
+ - name: 'Generate Interop Data using Python'
working-directory: lang/py
run: ./build.sh interop-data-generate
- - name: Generate Interop Data using C#
+ - name: 'Generate Interop Data using C#'
working-directory: lang/csharp
run: ./build.sh interop-data-generate
- - name: Run Interop Tests
- working-directory: lang/java/ipc
- run: mvn -B test -P interop-data-test
-
- - name: Test Reproducible Build
+ - name: 'Install Java Avro for other tests'
working-directory: .
- run: mvn clean verify -DskipTests -Dcyclonedx.skip artifact:compare
+ run: mvn -B install -PskipQuality
+
+ - name: 'Generate Interop Data using Java 8, 11, 17 & 21'
+ working-directory: lang/java/interop-data-test
+ run: mvn -B verify -Pgenerate-test-data
+
+ - name: 'Run Interop Tests using Java 8, 11, 17 & 21'
+ working-directory: lang/java/interop-data-test
+ run: mvn -B verify -Pcheck-test-data
arm64:
name: Java on Linux ARM64
runs-on: ["self-hosted", "asf-arm"]
steps:
- - name: Checkout
- uses: actions/checkout@v4
+ - name: 'Checkout sourcecode'
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- - name: Setup Temurin JDK
- uses: actions/setup-java@v4
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
distribution: 'temurin'
- java-version: 11
-
- - name: Cache Local Maven Repository
- uses: actions/cache@v4
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Cache Local Maven Repository'
+ uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Build
- run: |
- set -x
- export MAVEN_VERSION="3.9.4"
- wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
- tar zxvf apache-maven-$MAVEN_VERSION-bin.tar.gz
- export M2_HOME=$PWD/apache-maven-$MAVEN_VERSION
- export PATH="$M2_HOME/bin:$PATH"
- java -version
- mvn -version
- #MAVEN_OPTS="-Dsurefire.excludes=*TestCustomCodec*,*TestAllCodecs*,*TestNettyServer*" ./build.sh clean test
- ./build.sh clean test
+ run: ./build.sh clean test
+# set -x
+# export MAVEN_VERSION="3.9.6"
+# wget https://archive.apache.org/dist/maven/maven-3/$MAVEN_VERSION/binaries/apache-maven-$MAVEN_VERSION-bin.tar.gz
+# tar zxvf apache-maven-$MAVEN_VERSION-bin.tar.gz
+# export M2_HOME=$PWD/apache-maven-$MAVEN_VERSION
+# export PATH="$M2_HOME/bin:$PATH"
+# java -version
+# mvn -version
+# #MAVEN_OPTS="-Dsurefire.excludes=*TestCustomCodec*,*TestAllCodecs*,*TestNettyServer*" ./build.sh clean test
+# ./build.sh clean test
diff --git a/.github/workflows/test-lang-perl.yml b/.github/workflows/test-lang-perl.yml
index b746495117c..58627a7f3da 100644
--- a/.github/workflows/test-lang-perl.yml
+++ b/.github/workflows/test-lang-perl.yml
@@ -123,9 +123,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
@@ -163,4 +178,4 @@ jobs:
- name: Build
run: |
set -x
- ./build.sh clean test
\ No newline at end of file
+ ./build.sh clean test
diff --git a/.github/workflows/test-lang-php.yml b/.github/workflows/test-lang-php.yml
index 2f62048614a..6255a7f3498 100644
--- a/.github/workflows/test-lang-php.yml
+++ b/.github/workflows/test-lang-php.yml
@@ -96,9 +96,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
@@ -170,4 +185,4 @@ jobs:
run: |
set -x
composer --version
- ./build.sh clean test
\ No newline at end of file
+ ./build.sh clean test
diff --git a/.github/workflows/test-lang-py.yml b/.github/workflows/test-lang-py.yml
index f5f7ec4c422..3a2c161e6b6 100644
--- a/.github/workflows/test-lang-py.yml
+++ b/.github/workflows/test-lang-py.yml
@@ -127,9 +127,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
@@ -162,4 +177,4 @@ jobs:
- name: Build
run: |
set -x
- ./build.sh clean test
\ No newline at end of file
+ ./build.sh clean test
diff --git a/.github/workflows/test-lang-ruby.yml b/.github/workflows/test-lang-ruby.yml
index 216e2176846..5c5f5fa60a6 100644
--- a/.github/workflows/test-lang-ruby.yml
+++ b/.github/workflows/test-lang-ruby.yml
@@ -113,9 +113,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
diff --git a/.github/workflows/test-lang-rust-ci.yml b/.github/workflows/test-lang-rust-ci.yml
index 52aa799cbb6..3aae12e135e 100644
--- a/.github/workflows/test-lang-rust-ci.yml
+++ b/.github/workflows/test-lang-rust-ci.yml
@@ -152,9 +152,24 @@ jobs:
restore-keys: |
${{ runner.os }}-maven-
+ - name: 'Setup Temurin JDK 8, 11, 17 & 21'
+ uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
+ with:
+ distribution: 'temurin'
+ java-version: |
+ 8
+ 11
+ 17
+ 21
+
+ - name: 'Setup Maven 3.9.6'
+ uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
+ with:
+ maven-version: 3.9.6
+
- name: Install Java Avro for Interop Test
working-directory: .
- run: mvn -B install -DskipTests
+ run: mvn -B install -PskipQuality
- name: Create Interop Data Directory
working-directory: .
diff --git a/BUILD.md b/BUILD.md
index 5ef201aa6eb..b619b535769 100644
--- a/BUILD.md
+++ b/BUILD.md
@@ -4,7 +4,7 @@
The following packages must be installed before Avro can be built:
- - Java: JDK 1.8, Maven 3 or better, protobuf-compile
+ - Java: JDK 8, 11, 17 and 21 with the appropriate toolchain config, Maven 3.9.6 or better, protobuf-compile
- PHP: php7, phpunit, php7-gmp
- Python 3: 3.7 or greater, tox (tox will install other dependencies as needed)
- C: gcc, cmake, asciidoc, source-highlight, Jansson, pkg-config
diff --git a/build.sh b/build.sh
index ccf6a34b080..db444448bfb 100755
--- a/build.sh
+++ b/build.sh
@@ -217,7 +217,7 @@ do
else
gpg --pinentry-mode loopback --local-user="$GPG_LOCAL_USER" --passphrase "$password" --armor --output "$f.asc" --detach-sig "$f"
fi
-
+
done
set -x
@@ -308,12 +308,13 @@ do
echo "ENV HOME /home/$USER_NAME"
echo "RUN getent group $GROUP_ID || groupadd -g $GROUP_ID $USER_NAME"
echo "RUN getent passwd $USER_ID || useradd -g $GROUP_ID -u $USER_ID -k /root -m $USER_NAME"
+ echo "RUN mkdir -p /home/$USER_NAME/.m2/repository"
} > Dockerfile
# Include the ruby gemspec for preinstallation.
# shellcheck disable=SC2086
tar -cf- Dockerfile $DOCKER_EXTRA_CONTEXT | DOCKER_BUILDKIT=1 docker build $DOCKER_BUILD_XTRA_ARGS -t "$DOCKER_IMAGE_NAME" -
rm Dockerfile
- # By mapping the .m2 directory you can do an mvn install from
+ # By mapping the .m2/repository directory you can do an mvn install from
# within the container and use the result on your normal
# system. And this also is a significant speedup in subsequent
# builds because the dependencies are downloaded only once.
@@ -325,10 +326,13 @@ do
# extra second before the changes are available within the docker container.
# shellcheck disable=SC2086
docker run --rm -t -i \
- --env "JAVA=${JAVA:-8}" \
+ --env "JAVA=${JAVA:-21}" \
--user "${USER_NAME}" \
--volume "${HOME}/.gnupg:/home/${USER_NAME}/.gnupg" \
- --volume "${HOME}/.m2:/home/${USER_NAME}/.m2${DOCKER_MOUNT_FLAG}" \
+ --volume "${PWD}/share/docker/m2:/home/${USER_NAME}/.m2/" \
+ --volume "${PWD}/share/docker/m2/toolchains.xml:/home/${USER_NAME}/.m2/toolchains.xml" \
+ --volume "${HOME}/.m2/repository:/home/${USER_NAME}/.m2/repository${DOCKER_MOUNT_FLAG}" \
+ --volume "${HOME}/.m2/build-cache:/home/${USER_NAME}/.m2/build-cache${DOCKER_MOUNT_FLAG}" \
--volume "${PWD}:/home/${USER_NAME}/avro${DOCKER_MOUNT_FLAG}" \
--workdir "/home/${USER_NAME}/avro" \
${DOCKER_RUN_XTRA_ARGS} "$DOCKER_IMAGE_NAME" ${DOCKER_RUN_ENTRYPOINT}
diff --git a/lang/java/archetypes/avro-service-archetype/src/main/pom/pom.xml b/lang/java/archetypes/avro-service-archetype/src/main/pom/pom.xml
index 2685648e776..be2717556a5 100644
--- a/lang/java/archetypes/avro-service-archetype/src/main/pom/pom.xml
+++ b/lang/java/archetypes/avro-service-archetype/src/main/pom/pom.xml
@@ -34,7 +34,7 @@
${maven.compiler.source}
- ${maven.compiler.target}
+ ${maven.compiler.release}
${project.build.sourceEncoding}
${project.version}
${jackson-bom.version}
@@ -142,7 +142,7 @@
maven-compiler-plugin
\${maven.compiler.source}
- \${maven.compiler.target}
+ \${maven.compiler.release}
diff --git a/lang/java/avro/pom.xml b/lang/java/avro/pom.xml
index 672bbbd105d..172837b5a7c 100644
--- a/lang/java/avro/pom.xml
+++ b/lang/java/avro/pom.xml
@@ -55,6 +55,20 @@
+
+
+ src/test/resources
+
+
+ ../../../share/
+
+ schemas/**
+ test/**
+
+ share/
+
+
+
org.apache.maven.plugins
@@ -67,6 +81,7 @@
+
org.apache.maven.plugins
maven-surefire-plugin
@@ -100,122 +115,114 @@
-
-
-
-
- interop-data-generate
-
- false
-
-
-
-
- org.codehaus.mojo
- exec-maven-plugin
- ${exec-plugin.version}
-
-
-
- interop-generate-null-codec
- generate-resources
-
- org.apache.avro.util.RandomData
-
- ../../../share/test/schemas/interop.avsc
- ../../../build/interop/data/java.avro
- 100
-
-
- java
-
+
+
+ org.apache.maven.plugins
+ maven-invoker-plugin
+
+ true
+
+ true
+ ./src/it
+ ${project.build.directory}/it
+
+ pom.xml
+
+ verify
+ ${project.build.directory}/local-repo
+ ./src/it/settings.xml
+
+
+ true
+
+
+ clean
+ test
+
+
-
-
- interop-generate-deflate-codec
- generate-resources
-
- org.apache.avro.util.RandomData
-
- ../../../share/test/schemas/interop.avsc
- ../../../build/interop/data/java_deflate.avro
- 100
- deflate
-
-
- java
-
+
+
+ Populate the local repo for integration tests
+
+ install
+
+
-
-
- interop-generate-snappy-codec
- generate-resources
-
- org.apache.avro.util.RandomData
-
- ../../../share/test/schemas/interop.avsc
- ../../../build/interop/data/java_snappy.avro
- 100
- snappy
-
-
- java
-
+
+ Run all tests under Java 8
+
+ run
+
+
+
+ 8
+
+
+ 4.11.0
+
+
+
+ 8
+
+ ${project.build.directory}/it-jdk-8
+
+
-
-
- interop-generate-bzip2-codec
- generate-resources
-
- org.apache.avro.util.RandomData
-
- ../../../share/test/schemas/interop.avsc
- ../../../build/interop/data/java_bzip2.avro
- 100
- bzip2
-
-
- java
-
+
+ Run all tests under Java 11
+
+ run
+
+
+
+ 11
+
+
+ 11
+
+ ${project.build.directory}/it-jdk-11
+
+
+
+
+ Run all tests under Java 17
+
+ run
+
+
+
+ 17
+
+
+ 17
+
+ ${project.build.directory}/it-jdk-17
+
+
-
-
- interop-generate-xz-codec
- generate-resources
-
- org.apache.avro.util.RandomData
-
- ../../../share/test/schemas/interop.avsc
- ../../../build/interop/data/java_xz.avro
- 100
- xz
-
-
- java
-
+
+ Run all tests under Java 21
+
+ run
+
+
+
+ 21
+
+
+ 21
+
+ ${project.build.directory}/it-jdk-21
+
+
+
+
+
+
+
-
-
- interop-generate-zstandard-codec
- generate-resources
-
- org.apache.avro.util.RandomData
-
- ../../../share/test/schemas/interop.avsc
- ../../../build/interop/data/java_zstandard.avro
- 100
- zstandard
-
-
- java
-
-
-
-
-
-
-
diff --git a/lang/java/avro/src/it/pom.xml b/lang/java/avro/src/it/pom.xml
new file mode 100644
index 00000000000..5a83cff3ed4
--- /dev/null
+++ b/lang/java/avro/src/it/pom.xml
@@ -0,0 +1,165 @@
+
+
+
+ 4.0.0
+
+ nl.example.avro
+ integration-test
+ 1.0.0
+
+ jar
+ IT : Java @integrationTestingJDK@
+
+
+ UTF-8
+ UTF-8
+ 8
+
+
+
+
+
+ ../../src/test/resources
+
+
+ ../../../../../share/
+
+ schemas/**
+ test/**
+
+ share/
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-toolchains-plugin
+ @maven-toolchains-plugin.version@
+
+
+
+ toolchain
+
+
+
+
+
+
+ @integrationTestingJDK@
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ @maven-compiler-plugin.version@
+
+
+ default-compile
+
+ true
+
+
+
+ default-testCompile
+
+ ../../src/test/java
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ @maven-surefire-plugin.version@
+
+ false
+ true
+
+
+
+
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+
+ org.xerial.snappy
+ snappy-java
+ @snappy.version@
+ true
+
+
+
+ org.tukaani
+ xz
+ @tukaani.version@
+ true
+
+
+
+ com.github.luben
+ zstd-jni
+ @zstd-jni.version@
+ true
+
+
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ @junit5.version@
+ test
+
+
+
+ org.junit.jupiter
+ junit-jupiter
+ @junit5.version@
+ test
+
+
+
+ org.hamcrest
+ hamcrest-library
+ @hamcrest.version@
+ test
+
+
+
+ org.mockito
+ mockito-core
+ @mockito.version@
+ test
+
+
+
+
+
diff --git a/lang/java/avro/src/it/settings.xml b/lang/java/avro/src/it/settings.xml
new file mode 100644
index 00000000000..2e3d2e38201
--- /dev/null
+++ b/lang/java/avro/src/it/settings.xml
@@ -0,0 +1,51 @@
+
+
+
+
+
+ it-repo
+
+ true
+
+
+
+ local.central
+ @localRepositoryUrl@
+
+ true
+
+
+ true
+
+
+
+
+
+ local.central
+ @localRepositoryUrl@
+
+ true
+
+
+ true
+
+
+
+
+
+
diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java
deleted file mode 100644
index a2c5c4e1b7b..00000000000
--- a/lang/java/avro/src/main/java/org/apache/avro/reflect/FieldAccessUnsafe.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.avro.reflect;
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-
-import org.apache.avro.AvroRuntimeException;
-import org.apache.avro.io.Decoder;
-import org.apache.avro.io.Encoder;
-
-import sun.misc.Unsafe;
-
-@SuppressWarnings("restriction")
-class FieldAccessUnsafe extends FieldAccess {
-
- private static final Unsafe UNSAFE;
-
- static {
- try {
- Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
- theUnsafe.setAccessible(true);
- UNSAFE = (Unsafe) theUnsafe.get(null);
- // It seems not all Unsafe implementations implement the following method.
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- protected FieldAccessor getAccessor(Field field) {
- AvroEncode enc = field.getAnnotation(AvroEncode.class);
- if (enc != null)
- try {
- return new UnsafeCustomEncodedField(field, enc.using().getDeclaredConstructor().newInstance());
- } catch (Exception e) {
- throw new AvroRuntimeException("Could not instantiate custom Encoding");
- }
- Class> c = field.getType();
- if (c == int.class)
- return new UnsafeIntField(field);
- else if (c == long.class)
- return new UnsafeLongField(field);
- else if (c == byte.class)
- return new UnsafeByteField(field);
- else if (c == float.class)
- return new UnsafeFloatField(field);
- else if (c == double.class)
- return new UnsafeDoubleField(field);
- else if (c == char.class)
- return new UnsafeCharField(field);
- else if (c == boolean.class)
- return new UnsafeBooleanField(field);
- else if (c == short.class)
- return new UnsafeShortField(field);
- else
- return new UnsafeObjectField(field);
- }
-
- abstract static class UnsafeCachedField extends FieldAccessor {
- protected final long offset;
- protected Field field;
- protected final boolean isStringable;
-
- UnsafeCachedField(Field f) {
- this.offset = UNSAFE.objectFieldOffset(f);
- this.field = f;
- this.isStringable = f.isAnnotationPresent(Stringable.class);
- }
-
- @Override
- protected Field getField() {
- return field;
- }
-
- @Override
- protected boolean supportsIO() {
- return true;
- }
-
- @Override
- protected boolean isStringable() {
- return isStringable;
- }
- }
-
- final static class UnsafeIntField extends UnsafeCachedField {
- UnsafeIntField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putInt(object, offset, value == null ? INT_DEFAULT_VALUE : (Integer) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getInt(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putInt(object, offset, in.readInt());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeInt(UNSAFE.getInt(object, offset));
- }
- }
-
- final static class UnsafeFloatField extends UnsafeCachedField {
- protected UnsafeFloatField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putFloat(object, offset, value == null ? FLOAT_DEFAULT_VALUE : (Float) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getFloat(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putFloat(object, offset, in.readFloat());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeFloat(UNSAFE.getFloat(object, offset));
- }
- }
-
- final static class UnsafeShortField extends UnsafeCachedField {
- protected UnsafeShortField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putShort(object, offset, value == null ? SHORT_DEFAULT_VALUE : (Short) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getShort(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putShort(object, offset, (short) in.readInt());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeInt(UNSAFE.getShort(object, offset));
- }
- }
-
- final static class UnsafeByteField extends UnsafeCachedField {
- protected UnsafeByteField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putByte(object, offset, value == null ? BYTE_DEFAULT_VALUE : (Byte) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getByte(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putByte(object, offset, (byte) in.readInt());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeInt(UNSAFE.getByte(object, offset));
- }
- }
-
- final static class UnsafeBooleanField extends UnsafeCachedField {
- protected UnsafeBooleanField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putBoolean(object, offset, value == null ? BOOLEAN_DEFAULT_VALUE : (Boolean) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getBoolean(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putBoolean(object, offset, in.readBoolean());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeBoolean(UNSAFE.getBoolean(object, offset));
- }
- }
-
- final static class UnsafeCharField extends UnsafeCachedField {
- protected UnsafeCharField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putChar(object, offset, value == null ? CHAR_DEFAULT_VALUE : (Character) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getChar(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putChar(object, offset, (char) in.readInt());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeInt(UNSAFE.getChar(object, offset));
- }
- }
-
- final static class UnsafeLongField extends UnsafeCachedField {
- protected UnsafeLongField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putLong(object, offset, value == null ? LONG_DEFAULT_VALUE : (Long) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getLong(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putLong(object, offset, in.readLong());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeLong(UNSAFE.getLong(object, offset));
- }
- }
-
- final static class UnsafeDoubleField extends UnsafeCachedField {
- protected UnsafeDoubleField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putDouble(object, offset, value == null ? DOUBLE_DEFAULT_VALUE : (Double) value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getDouble(object, offset);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putDouble(object, offset, in.readDouble());
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- out.writeDouble(UNSAFE.getDouble(object, offset));
- }
- }
-
- final static class UnsafeObjectField extends UnsafeCachedField {
- protected UnsafeObjectField(Field f) {
- super(f);
- }
-
- @Override
- protected void set(Object object, Object value) {
- UNSAFE.putObject(object, offset, value);
- }
-
- @Override
- protected Object get(Object object) {
- return UNSAFE.getObject(object, offset);
- }
-
- @Override
- protected boolean supportsIO() {
- return false;
- }
-
- }
-
- final static class UnsafeCustomEncodedField extends UnsafeCachedField {
-
- private CustomEncoding> encoding;
-
- UnsafeCustomEncodedField(Field f, CustomEncoding> encoding) {
- super(f);
- this.encoding = encoding;
- }
-
- @Override
- protected Object get(Object object) throws IllegalAccessException {
- return UNSAFE.getObject(object, offset);
- }
-
- @Override
- protected void set(Object object, Object value) throws IllegalAccessException, IOException {
- UNSAFE.putObject(object, offset, value);
- }
-
- @Override
- protected void read(Object object, Decoder in) throws IOException {
- UNSAFE.putObject(object, offset, encoding.read(in));
- }
-
- @Override
- protected void write(Object object, Encoder out) throws IOException {
- encoding.write(UNSAFE.getObject(object, offset), out);
- }
-
- @Override
- protected boolean isCustomEncoded() {
- return true;
- }
- }
-}
diff --git a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java
index e96517d0f1c..4fa52d0345e 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/reflect/ReflectionUtil.java
@@ -56,25 +56,13 @@ static void resetFieldAccess() {
// so it is monomorphic and the JIT can inline
FieldAccess access = null;
try {
- if (null == System.getProperty("avro.disable.unsafe")) {
- FieldAccess unsafeAccess = load("org.apache.avro.reflect.FieldAccessUnsafe", FieldAccess.class);
- if (validate(unsafeAccess)) {
- access = unsafeAccess;
- }
- }
- } catch (Throwable ignored) {
- }
- if (access == null) {
- try {
- FieldAccess reflectAccess = load("org.apache.avro.reflect.FieldAccessReflect", FieldAccess.class);
- if (validate(reflectAccess)) {
- access = reflectAccess;
- }
- } catch (Throwable oops) {
- throw new AvroRuntimeException("Unable to load a functional FieldAccess class!");
+ FieldAccess reflectAccess = new FieldAccessReflect();
+ if (validate(reflectAccess)) {
+ fieldAccess = reflectAccess;
}
+ } catch (Throwable oops) {
+ throw new AvroRuntimeException("Unable to load a functional FieldAccess class!");
}
- fieldAccess = access;
}
private static T load(String name, Class type) throws Exception {
diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/RandomData.java b/lang/java/avro/src/main/java/org/apache/avro/util/RandomData.java
index 053bc7966a2..7ff7f477f35 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/util/RandomData.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/util/RandomData.java
@@ -30,6 +30,8 @@
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import java.time.Duration;
import java.util.Iterator;
import java.util.List;
@@ -208,7 +210,9 @@ public static void main(String[] args) throws Exception {
try (DataFileWriter
diff --git a/lang/java/pom.xml b/lang/java/pom.xml
index 7a863bfbe92..d1b1f69eb3d 100644
--- a/lang/java/pom.xml
+++ b/lang/java/pom.xml
@@ -90,6 +90,7 @@
grpc
integration-test
perf
+ interop-data-test
@@ -118,6 +119,7 @@
org.apache.maven.plugins
maven-compiler-plugin
+ ${maven-compiler-plugin.version}
-parameters
@@ -255,11 +257,17 @@
${project.name}
${project.artifactId}
+
${osgi.export}
+
${osgi.import}
+
${osgi.dynamic.import}
+
${osgi.private}
+
${osgi.bundles}
+
${osgi.activator}
@@ -307,7 +315,7 @@
${main.basedir}/lang/java/eclipse-java-formatter.xml
- 4.19.0
+ 4.19
@@ -350,6 +358,21 @@
+
+
+ skipQuality
+
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
+
+
m2e
@@ -446,31 +469,6 @@
-
- interop-data-test
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- **/DataFileInteropTest*
-
-
-
- false
- 1
- true
- false
-
- ../../../build/interop/data/
-
-
-
-
-
-
mac
@@ -562,11 +560,13 @@
org.mockito
mockito-core
${mockito.version}
+ test
org.hamcrest
hamcrest-library
${hamcrest.version}
+ test
org.xerial.snappy
diff --git a/lang/java/thrift/pom.xml b/lang/java/thrift/pom.xml
index 591dd255472..12a20258b42 100644
--- a/lang/java/thrift/pom.xml
+++ b/lang/java/thrift/pom.xml
@@ -50,6 +50,7 @@
+ org.apache.maven.plugins
maven-antrun-plugin
@@ -82,6 +83,25 @@
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+
+
+ default-cli
+
+ enforce
+
+
+
+
+ 11
+
+
+
+
+
+
org.apache.maven.plugins
maven-jar-plugin
diff --git a/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java b/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java
index 0e08318eb9f..3b82a0ceba5 100644
--- a/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java
+++ b/lang/java/thrift/src/main/java/org/apache/avro/thrift/ThriftData.java
@@ -107,7 +107,8 @@ protected Object getRecordState(Object r, Schema s) {
if (fields == null) { // cache miss
fields = new TFieldIdEnum[s.getFields().size()];
Class c = r.getClass();
- for (TFieldIdEnum f : FieldMetaData.getStructMetaDataMap((Class extends TBase>) c).keySet())
+ for (TFieldIdEnum f : ((Map) FieldMetaData
+ .getStructMetaDataMap((Class extends TBase>) c)).keySet())
fields[s.getField(f.getFieldName()).pos()] = f;
fieldCache.put(s, fields); // update cache
}
@@ -190,7 +191,8 @@ public Schema getSchema(Class c) {
} else if (TBase.class.isAssignableFrom(c)) { // struct
schema = Schema.createRecord(c.getName(), null, null, Throwable.class.isAssignableFrom(c));
List fields = new ArrayList<>();
- for (FieldMetaData f : FieldMetaData.getStructMetaDataMap((Class extends TBase>) c).values()) {
+ for (FieldMetaData f : ((Map) FieldMetaData
+ .getStructMetaDataMap((Class extends TBase>) c)).values()) {
Schema s = getSchema(f.valueMetaData);
if (f.requirementType == TFieldRequirementType.OPTIONAL && (s.getType() != Schema.Type.UNION))
s = nullable(s);
diff --git a/pom.xml b/pom.xml
index 2e7ab7f458b..63b9c5a654e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,7 +41,7 @@
-->
1.8
- 1.8
+ 8
${project.basedir}
dist
build/avro-doc-${project.version}/api
@@ -49,16 +49,18 @@
0.16
3.3.1
- 9.3
+ 10.10.0
3.4.1
1.7.0
3.1.0
+ 3.12.1
3.1.0
3.6.3
3.11.0
3.1.0
3.5.1
3.3.0
+ 3.1.0
3.5.2
2.42.0
3.2.5
@@ -159,13 +161,84 @@
maven-remote-resources-plugin
${maven-remote-resources-plugin.version}
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ ${enforcer-plugin.version}
+
+
+ org.apache.maven.plugins
+ maven-toolchains-plugin
+ ${maven-toolchains-plugin.version}
+
+
+
+
+ org.apache.maven.plugins
+ maven-toolchains-plugin
+
+
+ Ensure ToolChain for JDK 8 is available
+
+ toolchain
+
+
+
+
+ 8
+
+
+
+
+
+ Ensure ToolChain for JDK 11 is available
+
+ toolchain
+
+
+
+
+ 11
+
+
+
+
+
+ Ensure ToolChain for JDK 17 is available
+
+ toolchain
+
+
+
+
+ 17
+
+
+
+
+
+
+ Build using JDK 21
+
+ toolchain
+
+
+
+
+ 21
+
+
+
+
+
+
+
org.apache.maven.plugins
maven-enforcer-plugin
- ${enforcer-plugin.version}
default-cli
@@ -175,7 +248,11 @@
- 1.8
+ 8
+
+ test
+ provided
+
${env.VERSION}
+
*****!!!!! Version of project must be ${env.VERSION} !!!!!*****
-
- 1.8
-
-
- [1.8,)
-
@@ -372,6 +445,7 @@
**/*.rej
**/*.egg-info/**
build/**
+ share/docker/m2/build-cache/**
lang/java/archetypes/**
lang/java/**/target/**
lang/js/node_modules/**
diff --git a/share/docker/.gitignore b/share/docker/.gitignore
new file mode 100644
index 00000000000..a68681ff55a
--- /dev/null
+++ b/share/docker/.gitignore
@@ -0,0 +1,2 @@
+m2/repository
+m2/build-cache
diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile
index 8cae135d850..f4e4e18dcc4 100644
--- a/share/docker/Dockerfile
+++ b/share/docker/Dockerfile
@@ -17,7 +17,7 @@
# Dockerfile for installing the necessary dependencies for building Avro.
# See BUILD.md.
-FROM ubuntu:20.04
+FROM ubuntu:22.04
WORKDIR /root
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=isolemnlysweariamuptonogood \
@@ -55,9 +55,10 @@ RUN apt-get -qqy update \
libssl-dev \
make \
mypy \
+ openjdk-8-jdk \
openjdk-11-jdk \
openjdk-17-jdk \
- openjdk-8-jdk \
+ openjdk-21-jdk \
perl \
python3 \
python3-pip \
@@ -91,7 +92,7 @@ RUN apt-get -qqy install --no-install-recommends libzstd-dev \
# Install a maven release -------------------------------------------
# Inspired from https://github.com/apache/accumulo-docker/blob/bbb9892e165d40fb35fa19f38929effc5d0c709b/Dockerfile#L30
-ENV MAVEN_VERSION 3.8.6
+ENV MAVEN_VERSION 3.9.6
ENV APACHE_DIST_URLS \
https://www.apache.org/dyn/closer.cgi?action=download&filename= \
# if the version is outdated (or we're grabbing the .asc file), we might have to pull from the dist/archive :/
@@ -179,7 +180,7 @@ RUN curl -sSL https://cpanmin.us \
# Install Python3
ENV PATH="${PATH}:/opt/pypy3.8/bin:/opt/pypy3.9/bin:/opt/pypy3.10/bin" \
PIP_NO_CACHE_DIR=off
-
+
# https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
ARG BUILDARCH
RUN case "${BUILDARCH:?}" in \
@@ -213,10 +214,11 @@ RUN gem install bundler --no-document && \
# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.70.0
-# Note: This "ubertool" container has two JDK versions:
+# Note: This "ubertool" container has 4 JDK versions:
# - OpenJDK 8
# - OpenJDK 11
# - OpenJDK 17
+# - OpenJDK 21
# - The root build.sh script switches between the versions according to
# the JAVA environment variable.
@@ -232,7 +234,7 @@ RUN cd /opt ; \
ENV PATH $PATH:/opt/dotnet
-# Since we want the JDK8 as a default, we have to re-prepend it to the PATH.
-RUN update-java-alternatives -s "java-1.8.0*"
+# Since we want the JDK21 as a default, we have to re-prepend it to the PATH.
+RUN update-java-alternatives -s "java-1.21.*"
CMD ["/bin/bash", "-i"]
diff --git a/share/docker/m2/toolchains.xml b/share/docker/m2/toolchains.xml
new file mode 100644
index 00000000000..c9611d10421
--- /dev/null
+++ b/share/docker/m2/toolchains.xml
@@ -0,0 +1,56 @@
+
+
+
+
+ jdk
+
+ 8
+
+
+ /usr/lib/jvm/java-8-openjdk-amd64
+
+
+
+ jdk
+
+ 11
+
+
+ /usr/lib/jvm/java-11-openjdk-amd64
+
+
+
+ jdk
+
+ 17
+
+
+ /usr/lib/jvm/java-17-openjdk-amd64
+
+
+
+ jdk
+
+ 21
+
+
+ /usr/lib/jvm/java-21-openjdk-amd64
+
+
+