New release preparation (#643)
New release preparation
Signed-off-by: David Kral <david.k.kral@oracle.com>
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index cf59b9f..9569655 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2021, 2024 Oracle 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
@@ -21,32 +21,25 @@
strategy:
matrix:
- java_version: [ 11, 17 ]
+ java_version: [ 17, 21 ]
steps:
- name: Checkout for build
- uses: actions/checkout@v2.3.4
+ uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up compile JDK
uses: actions/setup-java@v4
- with: #Compile java needs to be the highest to ensure proper compilation of the multi-release jar
+ with:
distribution: 'temurin'
- java-version: 17
+ java-version: ${{ matrix.java_version }}
cache: 'maven'
- name: Copyright
run: bash etc/copyright.sh
- name: Checkstyle
run: mvn -B checkstyle:checkstyle
- name: Yasson install
-# run: mvn -U -C -Pstaging clean install -DskipTests
run: mvn -U -C clean install -DskipTests
- - name: Set up JDK for tests
- uses: actions/setup-java@v4
- with:
- distribution: 'temurin'
- java-version: ${{ matrix.java_version }}
- cache: 'maven'
- name: Yasson tests
run: mvn -U -B -C -Dmaven.javadoc.skip=true -Pstaging verify
- name: JSONB-API TCK
diff --git a/etc/checkstyle.xml b/etc/checkstyle.xml
index 3479136..69e6f2f 100644
--- a/etc/checkstyle.xml
+++ b/etc/checkstyle.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2019, 2022 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2019, 2024 Oracle 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
@@ -88,7 +88,7 @@
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod">
- <property name="scope" value="protected"/>
+ <property name="accessModifiers" value="protected"/>
<property name="allowMissingReturnTag" value="true"/>
<property name="allowMissingParamTags" value="true"/>
</module>
diff --git a/pom.xml b/pom.xml
index 0abc66b..b17b70c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2016, 2023 Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2016, 2024 Oracle 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
@@ -19,7 +19,7 @@
<parent>
<groupId>org.eclipse.ee4j</groupId>
<artifactId>project</artifactId>
- <version>1.0.7</version>
+ <version>1.0.9</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -34,11 +34,33 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <jakarta.json.version>2.1.0</jakarta.json.version>
- <parson.version>2.1.0</parson.version>
- <jakarta.json.bind.version>3.0.0</jakarta.json.bind.version>
- <jakarta.enterprise.cdi-api.version>4.0.1</jakarta.enterprise.cdi-api.version>
- <netbeans.hint.jdkPlatform>JDK_9</netbeans.hint.jdkPlatform>
+ <maven.compiler.release>17</maven.compiler.release>
+ <maven.compiler.testRelease>${maven.compiler.release}</maven.compiler.testRelease>
+
+ <!--Dependencies-->
+ <hamcrest.version>2.2</hamcrest.version>
+ <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.6</jakarta.parson.version>
+ <junit-jupiter.version>5.10.2</junit-jupiter.version>
+ <weld-se-core.version>6.0.0.Beta1</weld-se-core.version>
+
+ <!--Plugins-->
+ <build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
+ <buildnumber-maven-plugin.version>3.2.0</buildnumber-maven-plugin.version>
+ <spotbugs-maven-plugin.version>4.8.5.0</spotbugs-maven-plugin.version>
+ <glassfish-copyright-maven-plugin.version>2.4</glassfish-copyright-maven-plugin.version>
+ <maven-bundle-plugin.version>5.1.9</maven-bundle-plugin.version>
+ <maven-checkstyle-plugin.version>3.3.1</maven-checkstyle-plugin.version>
+ <maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
+ <maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>
+ <maven-jar-plugin.version>3.4.1</maven-jar-plugin.version>
+ <maven-javadoc-plugin.version>3.6.3</maven-javadoc-plugin.version>
+ <maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
</properties>
<dependencyManagement>
@@ -51,17 +73,17 @@
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
- <version>5.0.0</version>
+ <version>${jakarta.el-api.version}</version>
</dependency>
<dependency>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
- <version>2.1.0</version>
+ <version>${jakarta.interceptor-api.version}</version>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
- <version>2.1.0</version>
+ <version>${jakarta.annotation-api.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
@@ -81,7 +103,7 @@
<dependency>
<groupId>org.eclipse.parsson</groupId>
<artifactId>parsson</artifactId>
- <version>1.1.0</version>
+ <version>${jakarta.parson.version}</version>
</dependency>
<!-- Test/Provided dependencies -->
<dependency>
@@ -93,25 +115,25 @@
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
- <version>5.0.0.Final</version>
+ <version>${weld-se-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
- <version>5.8.2</version>
+ <version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
- <version>5.8.2</version>
+ <version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
- <version>2.2</version>
+ <version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -223,6 +245,30 @@
</build>
</profile>
<profile>
+ <id>spotbugs</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <version>${spotbugs-maven-plugin.version}</version>
+ <configuration>
+ <threshold>Low</threshold>
+ </configuration>
+ <executions>
+ <execution>
+ <id>analyze-compile</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
<id>copyright</id>
<build>
<plugins>
@@ -252,160 +298,19 @@
</plugins>
</build>
</profile>
- <profile>
- <id>jdk16</id>
- <activation>
- <jdk>[16,)</jdk>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- <executions>
- <execution>
- <id>default-testCompile</id>
- <configuration>
- <release>16</release>
- <compileSourceRoots>
- <compileSourceRoot>${project.basedir}/src/test/java</compileSourceRoot>
- <compileSourceRoot>${project.basedir}/src/test/java16</compileSourceRoot>
- </compileSourceRoots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <includes>
- <include>**/RecordTest.java</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <!-- remove when not needed -->
- <profile>
- <id>staging</id>
- <activation>
- <activeByDefault>false</activeByDefault>
- </activation>
- <repositories>
- <repository>
- <id>sonatype-nexus-staging</id>
- <name>Sonatype Nexus Staging</name>
- <url>${sonatypeOssDistMgmtStagingUrl}</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>sonatype-nexus-staging</id>
- <name>Sonatype Nexus Staging</name>
- <url>${sonatypeOssDistMgmtStagingUrl}</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
</profiles>
<build>
-<!-- <testResources>-->
-<!-- <testResource>-->
-<!-- <directory>src/test/resources</directory>-->
-<!-- <filtering>true</filtering>-->
-<!-- </testResource>-->
-<!-- </testResources>-->
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>3.0.4</version>
- <configuration>
- <effort>Max</effort>
- <threshold>Low</threshold>
- <xmlOutput>true</xmlOutput>
- </configuration>
- <executions>
- <execution>
- <id>analyze-compile</id>
- <phase>compile</phase>
- <goals>
- <goal>check</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <version>3.0.0-M3</version>
- </plugin>
- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.1</version>
- <executions>
- <execution>
- <id>default-compile</id>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <release>11</release>
- <source>11</source>
- <target>11</target>
- </configuration>
- </execution>
- <execution>
- <id>default-testCompile</id>
- <configuration>
- <release>11</release>
- </configuration>
- </execution>
- <execution>
- <id>multi-release-compile-16</id>
- <goals>
- <goal>compile</goal>
- </goals>
- <configuration>
- <release>16</release>
- <compileSourceRoots>
- <compileSourceRoot>${project.basedir}/src/main/java16</compileSourceRoot>
- </compileSourceRoots>
- <multiReleaseOutput>true</multiReleaseOutput>
- </configuration>
- </execution>
- </executions>
+ <version>${maven-compiler-plugin.version}</version>
<!-- defaults for compile and testCompile -->
<configuration>
<compilerArgs>
- <compilerArgument>-proc:none</compilerArgument>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
@@ -413,13 +318,10 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
- <version>3.0.2</version>
+ <version>${maven-jar-plugin.version}</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- <manifestEntries>
- <Multi-Release>true</Multi-Release>
- </manifestEntries>
</archive>
</configuration>
</plugin>
@@ -427,7 +329,7 @@
<!-- This plugin generates the buildNumber property used in maven-bundle-plugin -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
- <version>1.4</version>
+ <version>${buildnumber-maven-plugin.version}</version>
<configuration>
<format>{0,date,MM/dd/yyyy hh:mm aa}</format>
<items>
@@ -446,42 +348,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
- <version>3.2.0</version>
+ <version>${maven-javadoc-plugin.version}</version>
<configuration>
- <doctitle>Yasson</doctitle>
- <sourcepath>${basedir}/src/main/java/org/eclipse/yasson</sourcepath>
- <additionalJOptions>
- <additionalJOption>--add-modules</additionalJOption>
- <additionalJOption>jakarta.json.bind,jakarta.json</additionalJOption>
- </additionalJOptions>
- <source>11</source>
+ <bottom><![CDATA[Copyright © 2017, 2024 Oracle Corporation. All rights reserved.<br>]]></bottom>
</configuration>
- <executions>
- <execution>
- <id>attach-javadocs</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>3.0.1</version>
- <executions>
- <execution>
- <id>attach-sources</id>
- <goals>
- <goal>jar-no-fork</goal>
- </goals>
- </execution>
- </executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>5.1.1</version>
+ <version>${maven-bundle-plugin.version}</version>
<executions>
<execution>
<id>osgi-bundle</id>
@@ -514,7 +389,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.0.0-M3</version>
+ <version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<id>default-test</id>
@@ -549,7 +424,7 @@
<configuration>
<argLine>
<!--java.management is required by Maven's ForkedBooter-->
- --limit-modules java.base,java.logging,java.sql,jakarta.json.bind,jakarta.json,java.management,jdk.localedata
+ --limit-modules java.base,java.logging,java.sql,jakarta.json.bind,jakarta.json,java.management,jdk.localedata,org.eclipse.parsson,org.eclipse.yasson
</argLine>
<includes>
<include>**/JavaxNamingExcludedTest.class</include>
@@ -562,7 +437,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
- <version>3.0.0-M2</version>
+ <version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<id>enforce-versions</id>
@@ -574,10 +449,10 @@
<configuration>
<rules>
<requireJavaVersion>
- <version>[11,)</version>
+ <version>[17,)</version>
</requireJavaVersion>
<requireMavenVersion>
- <version>[3.3.9,)</version>
+ <version>[3.6.0,)</version>
</requireMavenVersion>
<DependencyConvergence/>
</rules>
@@ -586,7 +461,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>3.0.0</version>
+ <version>${build-helper-maven-plugin.version}</version>
<executions>
<execution>
<id>add-resource</id>
@@ -612,33 +487,19 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
- <version>3.1.0</version>
+ <version>${maven-checkstyle-plugin.version}</version>
<configuration>
<configLocation>etc/checkstyle.xml</configLocation>
<suppressionsLocation>etc/checkstyle-suppressions.xml</suppressionsLocation>
- <encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
- <dependencies>
- <dependency>
- <groupId>com.puppycrawl.tools</groupId>
- <artifactId>checkstyle</artifactId>
- <version>8.29</version>
- <exclusions>
- <exclusion>
- <groupId>com.sun</groupId>
- <artifactId>tools</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
</plugin>
<plugin>
<groupId>org.glassfish.copyright</groupId>
<artifactId>glassfish-copyright-maven-plugin</artifactId>
- <version>2.3</version>
+ <version>${glassfish-copyright-maven-plugin.version}</version>
<configuration>
<templateFile>etc/copyright.txt</templateFile>
<excludeFile>etc/copyright-exclude.txt</excludeFile>
@@ -691,14 +552,4 @@
</plugin>
</plugins>
</build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>findbugs-maven-plugin</artifactId>
- <version>3.0.4</version>
- </plugin>
- </plugins>
- </reporting>
</project>
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
index f6c0ace..12366c5 100644
--- a/src/main/java/module-info.java
+++ b/src/main/java/module-info.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2024 Oracle 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
@@ -11,7 +11,7 @@
*/
/**
- * Eclipse implementation of the JSONB-API.
+ * Yasson, the implementation of the Jakarta JSON Binding.
*/
module org.eclipse.yasson {
requires jakarta.json;
diff --git a/src/main/java/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java b/src/main/java/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java
index bcf0b14..2f3d2dc 100644
--- a/src/main/java/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java
+++ b/src/main/java/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2024 Oracle 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
@@ -22,6 +22,8 @@
import org.eclipse.yasson.internal.model.JsonbCreator;
import org.eclipse.yasson.internal.model.Property;
+import org.eclipse.yasson.internal.properties.MessageKeys;
+import org.eclipse.yasson.internal.properties.Messages;
/**
* Search for instance creator from other sources.
@@ -34,25 +36,38 @@
}
static boolean shouldTransformToPropertyName(Method method) {
- return true;
+ return !method.getDeclaringClass().isRecord();
}
static boolean isSpecialAccessorMethod(Method method, Map<String, Property> classProperties) {
- return false;
+ return isRecord(method.getDeclaringClass())
+ && method.getParameterCount() == 0
+ && !void.class.equals(method.getReturnType())
+ && classProperties.containsKey(method.getName());
}
static JsonbCreator findCreator(Class<?> clazz,
Constructor<?>[] declaredConstructors,
AnnotationIntrospector introspector,
PropertyNamingStrategy propertyNamingStrategy) {
+ if (clazz.isRecord()) {
+ if (declaredConstructors.length == 1) {
+ return introspector.createJsonbCreator(declaredConstructors[0], null, clazz, propertyNamingStrategy);
+ }
+ }
return null;
}
public static boolean isRecord(Class<?> clazz) {
- return false;
+ return clazz.isRecord();
}
public static Optional<JsonbException> exceptionToThrow(Class<?> clazz) {
+ if (clazz.isRecord()) {
+ if (clazz.getDeclaredConstructors().length > 1) {
+ return Optional.of(new JsonbException(Messages.getMessage(MessageKeys.RECORD_MULTIPLE_CONSTRUCTORS, clazz)));
+ }
+ }
return Optional.empty();
}
diff --git a/src/main/java/org/eclipse/yasson/internal/JsonBinding.java b/src/main/java/org/eclipse/yasson/internal/JsonBinding.java
index cd4764a..fb185de 100644
--- a/src/main/java/org/eclipse/yasson/internal/JsonBinding.java
+++ b/src/main/java/org/eclipse/yasson/internal/JsonBinding.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2024 Oracle 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
@@ -91,7 +91,7 @@
public <T> T fromJson(InputStream stream, Class<T> clazz) throws JsonbException {
DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);
try (JsonParser parser = inputStreamParser(stream)) {
- return deserialize(clazz, inputStreamParser(stream), unmarshaller);
+ return deserialize(clazz, parser, unmarshaller);
}
}
@@ -99,7 +99,7 @@
public <T> T fromJson(InputStream stream, Type type) throws JsonbException {
DeserializationContextImpl unmarshaller = new DeserializationContextImpl(jsonbContext);
try (JsonParser parser = inputStreamParser(stream)) {
- return deserialize(type, inputStreamParser(stream), unmarshaller);
+ return deserialize(type, parser, unmarshaller);
}
}
diff --git a/src/main/java16/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java b/src/main/java16/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java
deleted file mode 100644
index 2b062bf..0000000
--- a/src/main/java16/org/eclipse/yasson/internal/ClassMultiReleaseExtension.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2021, 2023 Oracle 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
- */
-
-package org.eclipse.yasson.internal;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.util.Map;
-import java.util.Optional;
-
-import jakarta.json.bind.JsonbException;
-import jakarta.json.bind.config.PropertyNamingStrategy;
-
-import org.eclipse.yasson.internal.model.JsonbCreator;
-import org.eclipse.yasson.internal.model.Property;
-import org.eclipse.yasson.internal.properties.MessageKeys;
-import org.eclipse.yasson.internal.properties.Messages;
-
-/**
- * Search for instance creator from other sources.
- * Mainly intended to add extensibility for different java versions and new features.
- */
-public class ClassMultiReleaseExtension {
-
- private ClassMultiReleaseExtension() {
- throw new IllegalStateException("This class cannot be instantiated");
- }
-
- static boolean shouldTransformToPropertyName(Method method) {
- return !method.getDeclaringClass().isRecord();
- }
-
- static boolean isSpecialAccessorMethod(Method method, Map<String, Property> classProperties) {
- return isRecord(method.getDeclaringClass())
- && method.getParameterCount() == 0
- && !void.class.equals(method.getReturnType())
- && classProperties.containsKey(method.getName());
- }
-
- static JsonbCreator findCreator(Class<?> clazz,
- Constructor<?>[] declaredConstructors,
- AnnotationIntrospector introspector,
- PropertyNamingStrategy propertyNamingStrategy) {
- if (clazz.isRecord()) {
- if (declaredConstructors.length == 1) {
- return introspector.createJsonbCreator(declaredConstructors[0], null, clazz, propertyNamingStrategy);
- }
- }
- return null;
- }
-
- public static boolean isRecord(Class<?> clazz) {
- return clazz.isRecord();
- }
-
- public static Optional<JsonbException> exceptionToThrow(Class<?> clazz) {
- if (clazz.isRecord()) {
- if (clazz.getDeclaredConstructors().length > 1) {
- return Optional.of(new JsonbException(Messages.getMessage(MessageKeys.RECORD_MULTIPLE_CONSTRUCTORS, clazz)));
- }
- }
- return Optional.empty();
- }
-
-}
diff --git a/src/test/java/org/eclipse/yasson/defaultmapping/SecurityManagerTest.java b/src/test/java/org/eclipse/yasson/defaultmapping/SecurityManagerTest.java
deleted file mode 100644
index 029e554..0000000
--- a/src/test/java/org/eclipse/yasson/defaultmapping/SecurityManagerTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2019, 2022 Oracle 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
- */
-
-package org.eclipse.yasson.defaultmapping;
-
-import org.junit.jupiter.api.*;
-
-import org.eclipse.yasson.serializers.model.Crate;
-
-import jakarta.json.bind.Jsonb;
-import jakarta.json.bind.JsonbBuilder;
-import jakarta.json.bind.JsonbConfig;
-import jakarta.json.bind.annotation.JsonbProperty;
-import jakarta.json.bind.config.PropertyVisibilityStrategy;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.math.BigDecimal;
-
-/**
- * Created by Roman Grigoriadi (roman.grigoriadi@oracle.com) on 28/04/2017.
- */
-
-public class SecurityManagerTest {
-
- static final String classesDir = SecurityManagerTest.class.getProtectionDomain().getCodeSource().getLocation().getFile();
-
- @BeforeAll
- public static void setUp() {
- System.setProperty("java.security.policy", classesDir + "test.policy");
- System.setProperty("java.security.debug", "failure");
- System.setSecurityManager(new SecurityManager());
- }
-
- @AfterAll
- public static void tearDown() {
- System.setSecurityManager(null);
- }
-
- @Test
- public void testWithSecurityManager() {
- Jsonb jsonb = JsonbBuilder.create(new JsonbConfig().withPropertyVisibilityStrategy(new PropertyVisibilityStrategy() {
- @Override
- public boolean isVisible(Field field) {
- return Modifier.isPublic(field.getModifiers()) || field.getName().equals("privateProperty");
- }
-
- @Override
- public boolean isVisible(Method method) {
- return Modifier.isPublic(method.getModifiers());
- }
- }));
-
- Pojo pojo = new Pojo();
- pojo.setStrProperty("string propery");
- Crate crate = new Crate();
- crate.crateBigDec = BigDecimal.TEN;
- crate.crateStr = "crate string";
- pojo.setCrate(crate);
-
- String result = jsonb.toJson(pojo);
- }
-
-
-
- public static class Pojo {
-
- //causes .setAccessible(true) in combination with custom visibility strategy
- private String privateProperty;
-
- @JsonbProperty("property1")
- private String strProperty;
-
- @JsonbProperty("property2")
- private Crate crate;
-
- public String getStrProperty() {
- return strProperty;
- }
-
- public void setStrProperty(String strProperty) {
- this.strProperty = strProperty;
- }
-
- public Crate getCrate() {
- return crate;
- }
-
- public void setCrate(Crate crate) {
- this.crate = crate;
- }
- }
-}
diff --git a/src/test/java/org/eclipse/yasson/internal/cdi/JndiBeanManager.java b/src/test/java/org/eclipse/yasson/internal/cdi/JndiBeanManager.java
index 8698624..9087ef9 100644
--- a/src/test/java/org/eclipse/yasson/internal/cdi/JndiBeanManager.java
+++ b/src/test/java/org/eclipse/yasson/internal/cdi/JndiBeanManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2024 Oracle 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
@@ -39,6 +39,7 @@
import jakarta.enterprise.inject.spi.ProducerFactory;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
+import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -164,6 +165,11 @@
}
@Override
+ public Collection<Context> getContexts(Class<? extends Annotation> aClass) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ @Override
public ELResolver getELResolver() {
throw new UnsupportedOperationException("Not implemented");
}
@@ -242,4 +248,14 @@
public Instance<Object> createInstance() {
throw new UnsupportedOperationException("Not implemented");
}
+
+ @Override
+ public boolean isMatchingBean(Set<Type> set, Set<Annotation> set1, Type type, Set<Annotation> set2) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ @Override
+ public boolean isMatchingEvent(Type type, Set<Annotation> set, Type type1, Set<Annotation> set1) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
}
diff --git a/src/test/java16/org/eclipse/yasson/records/Car.java b/src/test/java/org/eclipse/yasson/records/Car.java
similarity index 87%
rename from src/test/java16/org/eclipse/yasson/records/Car.java
rename to src/test/java/org/eclipse/yasson/records/Car.java
index d001315..d32e317 100644
--- a/src/test/java16/org/eclipse/yasson/records/Car.java
+++ b/src/test/java/org/eclipse/yasson/records/Car.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java b/src/test/java/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java
similarity index 96%
rename from src/test/java16/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java
rename to src/test/java/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java
index 57c2407..d1875be 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithCreateNamingStrategyTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2023 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithCreator.java b/src/test/java/org/eclipse/yasson/records/CarWithCreator.java
similarity index 90%
rename from src/test/java16/org/eclipse/yasson/records/CarWithCreator.java
rename to src/test/java/org/eclipse/yasson/records/CarWithCreator.java
index 08f5978..b19fa0b 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithCreator.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithDefaultConstructor.java b/src/test/java/org/eclipse/yasson/records/CarWithDefaultConstructor.java
similarity index 87%
rename from src/test/java16/org/eclipse/yasson/records/CarWithDefaultConstructor.java
rename to src/test/java/org/eclipse/yasson/records/CarWithDefaultConstructor.java
index 3a9f398..c5bc540 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithDefaultConstructor.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithDefaultConstructor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithExtraMethod.java b/src/test/java/org/eclipse/yasson/records/CarWithExtraMethod.java
similarity index 86%
rename from src/test/java16/org/eclipse/yasson/records/CarWithExtraMethod.java
rename to src/test/java/org/eclipse/yasson/records/CarWithExtraMethod.java
index 685a237..35cba7b 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithExtraMethod.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithExtraMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithMultipleConstructors.java b/src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructors.java
similarity index 87%
rename from src/test/java16/org/eclipse/yasson/records/CarWithMultipleConstructors.java
rename to src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructors.java
index 39f6ef4..59e302d 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithMultipleConstructors.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructors.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java b/src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java
similarity index 90%
rename from src/test/java16/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java
rename to src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java
index 6a01819..c98fd21 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithMultipleConstructorsAndCreator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/CarWithoutAnnotations.java b/src/test/java/org/eclipse/yasson/records/CarWithoutAnnotations.java
similarity index 85%
rename from src/test/java16/org/eclipse/yasson/records/CarWithoutAnnotations.java
rename to src/test/java/org/eclipse/yasson/records/CarWithoutAnnotations.java
index fc1511e..b6cca66 100644
--- a/src/test/java16/org/eclipse/yasson/records/CarWithoutAnnotations.java
+++ b/src/test/java/org/eclipse/yasson/records/CarWithoutAnnotations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2024 Oracle 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
diff --git a/src/test/java16/org/eclipse/yasson/records/RecordTest.java b/src/test/java/org/eclipse/yasson/records/RecordTest.java
similarity index 98%
rename from src/test/java16/org/eclipse/yasson/records/RecordTest.java
rename to src/test/java/org/eclipse/yasson/records/RecordTest.java
index f8ebdd1..2b6a61e 100644
--- a/src/test/java16/org/eclipse/yasson/records/RecordTest.java
+++ b/src/test/java/org/eclipse/yasson/records/RecordTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2022 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 2024 Oracle 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
diff --git a/yasson-tck/pom.xml b/yasson-tck/pom.xml
index dea9598..1abbd05 100644
--- a/yasson-tck/pom.xml
+++ b/yasson-tck/pom.xml
@@ -11,11 +11,11 @@
<properties>
<jsonb.tck.version>3.0.0</jsonb.tck.version>
- <yasson.version>3.0.0-SNAPSHOT</yasson.version>
- <jakarta.json.bind.version>3.0.0</jakarta.json.bind.version>
- <jakarta.json.version>2.1.0</jakarta.json.version>
- <maven.compiler.source>11</maven.compiler.source>
- <maven.compiler.target>11</maven.compiler.target>
+ <yasson.version>3.0.4-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>17</maven.compiler.source>
+ <maven.compiler.target>17</maven.compiler.target>
</properties>
<!-- TODO: Temporarily enable snapshot repository -->
@@ -37,13 +37,13 @@
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
- <version>3.0.0</version>
+ <version>${jakarta.json.bind.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
- <version>2.1.0</version>
+ <version>${jakarta.json.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -55,13 +55,13 @@
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
- <version>5.0.1.Final</version>
+ <version>6.0.0.Beta1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit5</groupId>
<artifactId>arquillian-junit5-container</artifactId>
- <version>1.7.0.Alpha10</version>
+ <version>1.8.0.Final</version>
</dependency>
</dependencies>
@@ -70,7 +70,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
- <version>3.2.0</version>
+ <version>3.6.1</version>
<executions>
<execution>
<id>copy</id>
@@ -105,22 +105,22 @@
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
- <version>3.0.0-M5</version>
+ <version>3.2.5</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
<failIfNoTests>true</failIfNoTests>
<dependenciesToScan>jakarta.json.bind:jakarta.json.bind-tck</dependenciesToScan>
<systemPropertyVariables>
- <jimage.dir>${project.build.directory}/jdk11-bundle</jimage.dir>
+ <jimage.dir>${project.build.directory}/jdk-bundle</jimage.dir>
<signature.sigTestClasspath>
- ${project.build.directory}/signaturedirectory/jakarta.json.bind-api.jar:${project.build.directory}/jdk11-bundle/java.base:${project.build.directory}/jdk11-bundle/java.rmi:${project.build.directory}/jdk11-bundle/java.sql:${project.build.directory}/jdk11-bundle/java.naming
+ ${project.build.directory}/signaturedirectory/jakarta.json.bind-api.jar:${project.build.directory}/jdk-bundle/java.base:${project.build.directory}/jdk-bundle/java.rmi:${project.build.directory}/jdk-bundle/java.sql:${project.build.directory}/jdk-bundle/java.naming
</signature.sigTestClasspath>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>3.0.0-M4</version>
+ <version>3.2.5</version>
<executions>
<execution>
<id>post-unit-test</id>