diff --git a/.gitignore b/.gitignore index 1271c273..36a4b3c7 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,6 @@ target *.iml *.ipr *.iws + /target +dependency-reduced-pom.xml diff --git a/jr-record-test/pom.xml b/jr-record-test/pom.xml index 6758cf5a..7e2fde36 100644 --- a/jr-record-test/pom.xml +++ b/jr-record-test/pom.xml @@ -69,4 +69,58 @@ + + + + java17 + + 17 + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + generate-test-sources + + add-test-source + + + + src/test-jdk17/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + true + + + 17 + 17 + + -parameters + + + + + org.apache.maven.plugins + maven-surefire-plugin + + --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED + + + + + + + diff --git a/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java b/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java index 7ff96171..40d1b9dc 100644 --- a/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java +++ b/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java @@ -1,10 +1,8 @@ package jr; -import java.io.IOException; import java.util.Map; import com.fasterxml.jackson.jr.ob.JSON; -import com.fasterxml.jackson.jr.ob.JSON.Feature; import junit.framework.TestCase; @@ -13,13 +11,14 @@ */ public class Java17RecordTest extends TestCase { - record Cow(String message, Map object) { + public record Cow(String message, Map object) { } // [jackson-jr#94] public void testJava14RecordSerialization() throws Exception { - //JSON json = JSON.builder().enable(Feature.USE_FIELD_MATCHING_GETTERS).build(); - JSON json = JSON.std(); + // 13-Jun-2024, tatu: why is this explicitly needed? + JSON json = JSON.builder().enable(JSON.Feature.USE_FIELD_MATCHING_GETTERS).build(); + //JSON json = JSON.std; var expectedDoc = "{\"message\":\"MOO\",\"object\":{\"Foo\":\"Bar\"}}"; Cow input = new Cow("MOO", Map.of("Foo", "Bar")); @@ -28,8 +27,9 @@ public void testJava14RecordSerialization() throws Exception { // [jackson-jr#148] public void testJava14RecordDeserialization() throws Exception { - //JSON json = JSON.builder().enable(Feature.USE_FIELD_MATCHING_GETTERS).build(); - JSON json = JSON.std(); + // 13-Jun-2024, tatu: why is this explicitly needed? + JSON json = JSON.builder().enable(JSON.Feature.USE_FIELD_MATCHING_GETTERS).build(); + //JSON json = JSON.std; String inputDoc = "{\"message\":\"MOO\",\"object\":{\"Foo\":\"Bar\"}}"; Cow expected = new Cow("MOO", Map.of("Foo", "Bar"));