Merge pull request #683 from jamezp/issue682
[682] Correct the fix for 670 and return the type if the type has alr…
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index 56e8e7c..6374c2a 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -24,20 +24,26 @@
jobs:
build:
- name: Test on JDK ${{ matrix.java_version }}
+ name: Test on JDK ${{ matrix.java_version }} locale ${{ matrix.locale }}
runs-on: ubuntu-latest
strategy:
matrix:
java_version: [ 11, 17, 21 ]
+ include:
+ - locale: en_US
+ # Use a different locale when running against one of the java versions
+ # to ensure we correctly write tests that account for localization differences.
+ - locale: de_AT
+ java_version: 21
steps:
- name: Checkout for build
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- name: Set up compile JDK
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
+ uses: actions/setup-java@03ad4de0992f5dab5e18fcb136590ce7c4a0ac95 # v5.6.0
with: #Compile java needs to be the highest to ensure proper compilation of the multi-release jar
distribution: 'temurin'
java-version: 17
@@ -49,6 +55,12 @@
- name: Yasson install
run: mvn -U -C clean install -DskipTests
- name: Yasson tests
- run: mvn -U -B -C -Dmaven.javadoc.skip=true verify
+ run: |
+ export LANG_TAG="${{ matrix.locale }}"
+ mvn -U -B -C \
+ -Dmaven.javadoc.skip=true \
+ -Duser.language="${LANG_TAG%%_*}" \
+ -Duser.country="${LANG_TAG##*_}" \
+ verify
- name: JSONB-API TCK
run: cd yasson-tck && mvn -U -B test -DargLine="-Djava.locale.providers=COMPAT"
diff --git a/.github/workflows/performance.yml b/.github/workflows/performance.yml
new file mode 100644
index 0000000..1e06af1
--- /dev/null
+++ b/.github/workflows/performance.yml
@@ -0,0 +1,62 @@
+#
+# Copyright (c) 2026 Eclipse Foundation and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0 which is available at
+# http://www.eclipse.org/legal/epl-2.0,
+# or the Eclipse Distribution License v. 1.0 which is available at
+# http://www.eclipse.org/org/documents/edl-v10.php.
+#
+# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+#
+
+# This workflow performs performance testing using JMH.
+# It is intended to be run on a schedule (e.g. weekly) to track performance over time, but can also be triggered manually when needed.
+# Persist results to github pages for continuous line graphs and regression alerts.
+
+name: Performance
+
+on:
+ schedule:
+ # Runs every Tuesday at 4:13 AM UTC (avoid peak hours for better performance results)
+ - cron: '13 4 * * 2'
+ workflow_dispatch:
+
+jobs:
+ performance:
+ name: Run JMH performance tests
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout for performance
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0
+ - name: Set up compile JDK
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
+ with: #Compile java needs to be the highest to ensure proper compilation of the multi-release jar
+ distribution: 'temurin'
+ java-version: 17
+ cache: 'maven'
+ - name: Compile Yasson
+ run: |
+ mvn -U -C clean install -DskipTests
+ - name: Run JMH performance tests
+ run: |
+ cd yasson-jmh
+ mvn -U -B clean package
+ java -jar target/yasson-jmh.jar -rf json -rff jmh-result.json
+ - name: Persist JMH results
+ uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1
+ with:
+ name: Java JMH Benchmark
+ tool: 'jmh'
+ output-file-path: jmh-result.json
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+
+ # Enable deployment to GitHub Pages for continuous line graphs
+ auto-push: true
+ comment-on-alert: true # Creates a comment if performance degrades
+ fail-on-alert: true # Fails the workflow run on regression
+ alert-threshold: '200%' # Triggers an alert if execution time doubles
+
diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml
new file mode 100644
index 0000000..5329115
--- /dev/null
+++ b/.github/workflows/verify.yml
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2026 Eclipse Foundation and/or its affiliates. All rights reserved.
+#
+# This program and the accompanying materials are made available under the
+# terms of the Eclipse Public License v. 2.0 which is available at
+# http://www.eclipse.org/legal/epl-2.0,
+# or the Eclipse Distribution License v. 1.0 which is available at
+# http://www.eclipse.org/org/documents/edl-v10.php.
+#
+# SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
+#
+
+# This workflow is used to verify this project against staged versions of the API and TCK.
+# It is not intended to be used for regular CI builds, but rather as a manual workflow that can be triggered when needed.
+
+name: Verify
+
+on:
+ workflow_dispatch:
+ inputs:
+ jsonb_version:
+ description: 'The version of the TCK to verify against (e.g. 3.1.0-M1)'
+ required: true
+
+jobs:
+ verify:
+ name: Verify against staged API or TCK
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout for verify
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ fetch-depth: 0
+ - name: Set up compile JDK
+ uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
+ with: #Compile java needs to be the highest to ensure proper compilation of the multi-release jar
+ distribution: 'temurin'
+ java-version: 17
+ cache: 'maven'
+ - name: Compile Yasson
+ run: |
+ mvn -U -C clean install \
+ -Pstaged \
+ -Djakarta.json.bind.version=${{ github.event.inputs.jsonb_version }} \
+ -DskipTests
+ - name: Run TCK
+ run: |
+ cd yasson-tck
+ mvn -U -B test \
+ -Pstaged \
+ -Djakarta.json.bind.version=${{ github.event.inputs.jsonb_version }} \
+ -Djsonb.tck.version=${{ github.event.inputs.jsonb_version }} \
+ -DargLine="-Djava.locale.providers=COMPAT"
diff --git a/.gitignore b/.gitignore
index 231039b..7cd0fac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@
.project
.idea/
.settings/
-/.DS_Store
+.DS_Store
bin/
.envrc
.vscode/
diff --git a/pom.xml b/pom.xml
index 0a0c8a3..fcbef73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@
<parent>
<groupId>org.eclipse.ee4j</groupId>
<artifactId>project</artifactId>
- <version>2.0.2</version>
+ <version>2.0.4</version>
</parent>
<groupId>org.eclipse</groupId>
@@ -34,21 +34,30 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
<maven.compiler.release>11</maven.compiler.release>
+ <maven.compiler.target>11</maven.compiler.target>
<maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>
+
<nexus.staging.repository>yasson-maven2-staging</nexus.staging.repository>
<!--Dependencies-->
<hamcrest.version>2.2</hamcrest.version>
+
+ <!-- Jakarta API -->
<jakarta.annotation-api.version>3.0.0</jakarta.annotation-api.version>
<jakarta.el-api.version>6.0.0</jakarta.el-api.version>
<jakarta.enterprise.cdi-api.version>4.1.0</jakarta.enterprise.cdi-api.version>
<jakarta.interceptor-api.version>2.2.0</jakarta.interceptor-api.version>
<jakarta.json.bind.version>3.0.1</jakarta.json.bind.version>
<jakarta.json.version>2.1.3</jakarta.json.version>
- <jakarta.parson.version>1.1.7</jakarta.parson.version>
- <junit-jupiter.version>5.10.2</junit-jupiter.version>
- <weld-se-core.version>6.0.0.Beta1</weld-se-core.version>
+
+ <!-- Jakarta Implementation -->
+ <jakarta.parson.version>1.1.9</jakarta.parson.version>
+
+ <!-- Test dependencies-->
+ <junit-jupiter.version>5.14.4</junit-jupiter.version> <!-- TODO update to Junit 6 when running on Java 17+ -->
+ <weld-se-core.version>6.0.4.Final</weld-se-core.version>
<!--Plugins-->
<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
@@ -365,9 +374,9 @@
<goal>compile</goal>
</goals>
<configuration>
- <release>11</release>
- <source>11</source>
- <target>11</target>
+ <release>${maven.compiler.release}</release>
+ <source>${maven.compiler.release}</source>
+ <target>${maven.compiler.release}</target>
</configuration>
</execution>
<execution>
@@ -434,7 +443,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
- <bottom><![CDATA[Copyright © 2017, 2024 Oracle Corporation. All rights reserved.<br>]]></bottom>
+ <bottom><![CDATA[Copyright © 2017, 2026 Oracle Corporation. All rights reserved.<br>]]></bottom>
</configuration>
</plugin>
<plugin>
diff --git a/src/test/java/org/eclipse/yasson/documented/DocumentationExampleTest.java b/src/test/java/org/eclipse/yasson/documented/DocumentationExampleTest.java
index d49e4a0..5012e78 100644
--- a/src/test/java/org/eclipse/yasson/documented/DocumentationExampleTest.java
+++ b/src/test/java/org/eclipse/yasson/documented/DocumentationExampleTest.java
@@ -351,7 +351,7 @@
@JsonbDateFormat("dd.MM.yyyy")
public LocalDate birthDate;
- @JsonbNumberFormat("#0.00")
+ @JsonbNumberFormat(value = "#0.00", locale="en_US")
public BigDecimal salary;
}
@@ -375,24 +375,25 @@
public LocalDate birthDate;
+ @JsonbNumberFormat(value = "#0.00", locale="en_US") // TODO: remove if withNumberFormat is added to JsonbConfig builder
public BigDecimal salary;
}
- @Test
+ @Test //TODO https://github.com/eclipse-ee4j/yasson/issues/722
public void testDateNumberFormats2() {
Person10 p = new Person10();
p.name = "Jason Bourne";
p.birthDate = LocalDate.of(1999, 8, 7);
p.salary = new BigDecimal("123.45678");
Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()//
- .withDateFormat("dd.MM.yyyy", null)); // TODO: why no withNumberFormat?
+ .withDateFormat("dd.MM.yyyy", null)); // TODO: add withNumberFormat if added to JsonbConfig builder
String json = jsonb.toJson(p);
- assertEquals("{\"birthDate\":\"07.08.1999\",\"name\":\"Jason Bourne\",\"salary\":123.45678}", json);
+ assertEquals("{\"birthDate\":\"07.08.1999\",\"name\":\"Jason Bourne\",\"salary\":\"123.46\"}", json);
- Person9 after = jsonb.fromJson("{\"birthDate\":\"07.08.1999\",\"name\":\"Jason Bourne\",\"salary\":123.45678}", Person9.class);
+ Person9 after = jsonb.fromJson("{\"birthDate\":\"07.08.1999\",\"name\":\"Jason Bourne\",\"salary\":\"123.46\"}", Person9.class);
assertEquals(p.name, after.name);
assertEquals(p.birthDate, after.birthDate);
- assertEquals(p.salary, after.salary);
+ assertEquals(new BigDecimal("123.46"), after.salary);
}
public static class Customer {
diff --git a/yasson-jmh/pom.xml b/yasson-jmh/pom.xml
index dcdd303..61d3046 100644
--- a/yasson-jmh/pom.xml
+++ b/yasson-jmh/pom.xml
@@ -5,6 +5,12 @@
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.ee4j</groupId>
+ <artifactId>project</artifactId>
+ <version>2.0.4</version>
+ </parent>
+
<groupId>org.eclipse.yasson</groupId>
<artifactId>yasson-jmh</artifactId>
<version>1.0-SNAPSHOT</version>
@@ -14,7 +20,7 @@
<properties>
<jmh.version>1.21</jmh.version>
- <yasson.version>2.0.2-SNAPSHOT</yasson.version>
+ <yasson.version>3.0.5-SNAPSHOT</yasson.version>
</properties>
diff --git a/yasson-tck/pom.xml b/yasson-tck/pom.xml
index c3d36c7..bab505d 100644
--- a/yasson-tck/pom.xml
+++ b/yasson-tck/pom.xml
@@ -5,17 +5,38 @@
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.ee4j</groupId>
+ <artifactId>project</artifactId>
+ <version>2.0.4</version>
+ <relativePath/>
+ </parent>
+
<groupId>org.eclipse</groupId>
<artifactId>yasson-tck</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
- <jsonb.tck.version>3.0.0</jsonb.tck.version>
- <yasson.version>3.0.5-SNAPSHOT</yasson.version>
- <jakarta.json.bind.version>3.0.1</jakarta.json.bind.version>
- <jakarta.json.version>2.1.3</jakarta.json.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
+
+ <!-- API Versions -->
+ <jakarta.json.version>2.1.3</jakarta.json.version> <!-- EE10 -->
+ <jakarta.json.bind.version>3.0.1</jakarta.json.bind.version> <!-- EE10 -->
+
+ <!-- IMPL Versions -->
+ <jsonb.tck.version>3.0.0</jsonb.tck.version> <!-- EE10 -->
+ <yasson.version>3.0.5-SNAPSHOT</yasson.version> <!-- EE10 -->
+
+ <!-- Test Versions -->
+ <junit-jupiter.version>5.14.4</junit-jupiter.version> <!-- TODO update to Junit 6 when running on Java 17+ -->
+ <weld-se-core.version>6.0.4.Final</weld-se-core.version>
+ <arquillian-junit5-container.version>1.8.0.Final</arquillian-junit5-container.version>
+
+ <!-- Plugin Versions -->
+ <maven-dependency-plugin.version>3.6.1</maven-dependency-plugin.version>
+ <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
+ <maven-surefire-report-plugin.version>3.2.5</maven-surefire-report-plugin.version>
</properties>
<dependencies>
@@ -46,13 +67,13 @@
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
- <version>6.0.0.Beta1</version>
+ <version>${weld-se-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
- <version>1.8.0.Final</version>
+ <version>${arquillian-junit5-container.version}</version>
</dependency>
</dependencies>
@@ -61,7 +82,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
- <version>3.6.1</version>
+ <version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>copy</id>
@@ -96,7 +117,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.2.5</version>
+ <version>${maven-surefire-plugin.version}</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<failIfNoTests>true</failIfNoTests>
@@ -111,7 +132,7 @@
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>3.2.5</version>
+ <version>${maven-surefire-report-plugin.version}</version>
<executions>
<execution>
<id>post-unit-test</id>