add jdk17 test

This commit is contained in:
shaojin.wensj 2023-05-30 10:07:22 +08:00
parent 85d64d0230
commit 0a87bbd289
3 changed files with 61 additions and 0 deletions

View File

@ -1019,6 +1019,7 @@
<module>extension-spring6</module>
<module>example-spring6-test</module>
<module>incubator-vector</module>
<module>test-jdk17</module>
</modules>
</profile>
<profile>

32
test-jdk17/pom.xml Normal file
View File

@ -0,0 +1,32 @@
<?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.34-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>test-jdk17</artifactId>
<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>17</maven.compiler.source>
<maven.compiler.target>${maven.compiler.source}</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,28 @@
package com.alibaba.fastjson2.issues;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class Issue1511 {
@Test
public void test1() {
R1 r = new R1(true);
String str = JSON.toJSONString(r);
assertEquals("{\"isActivation\":true}", str);
}
@Test
public void test2() {
R2 r = new R2(true);
String str = JSON.toJSONString(r);
assertEquals("{\"activation\":true}", str);
}
private record R1(boolean isActivation) {
}
private record R2(boolean activation) {
}
}