add jdk25 test

This commit is contained in:
wenshao 2025-09-22 14:25:41 +08:00
parent 95f0723889
commit e8723c9f8b
4 changed files with 68 additions and 1 deletions

View File

@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ ubuntu-24.04, windows-latest, macos-latest ]
java: [ 8, 11, 17, 21 ]
java: [ 8, 11, 17, 21, 25 ]
fail-fast: false
max-parallel: 16
name: Test on JDK ${{ matrix.java }} OS ${{ matrix.os }}

View File

@ -1024,6 +1024,15 @@
<module>test-jdk17</module>
</modules>
</profile>
<profile>
<id>enable-incubators-for-jdk25+</id>
<activation>
<jdk>[25,)</jdk>
</activation>
<modules>
<module>test-jdk25</module>
</modules>
</profile>
<profile>
<id>enable-for-jdk21+</id>
<activation>

37
test-jdk25/pom.xml Normal file
View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2-parent</artifactId>
<version>2.0.60-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>test-jdk25</artifactId>
<name>test-jdk25</name>
<properties>
<!--
skip maven deploy
https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html#skip
-->
<maven.deploy.skip>true</maven.deploy.skip>
<maven.compiler.source>25</maven.compiler.source>
<maven.compiler.target>25</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,21 @@
package com.alibaba.fastjson2;
import org.junit.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Java25Test {
@Test
public void test() {
Bean bean = new Bean(123, "abc");
String str = JSON.toJSONString(bean);
Bean bean1 = JSON.parseObject(str, Bean.class);
assertEquals(bean.id(), bean1.id());
assertEquals(bean.name(), bean1.name());
}
public record Bean(int id, String name) {
}
}