amount
+ * the getter would be amount()
)
+ * */
+ USE_FIELD_NAME_GETTERS(true,true),
+
/**
* Feature that enables use of public fields instead of setters and getters,
* in cases where no setter/getter is available.
diff --git a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java
index 59548f8d..cdb09895 100644
--- a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java
+++ b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java
@@ -4,13 +4,17 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
+import java.util.Arrays;
import java.util.Map;
import java.util.TreeMap;
-import com.fasterxml.jackson.jr.ob.JSON;
import com.fasterxml.jackson.jr.ob.impl.POJODefinition.Prop;
import com.fasterxml.jackson.jr.ob.impl.POJODefinition.PropBuilder;
+
+import static com.fasterxml.jackson.jr.ob.JSON.Feature.INCLUDE_STATIC_FIELDS;
+import static com.fasterxml.jackson.jr.ob.JSON.Feature.USE_FIELD_NAME_GETTERS;
+
/**
* Helper class that jackson-jr uses by default to introspect POJO properties
* (represented as {@link POJODefinition}) to build general POJO readers
@@ -97,7 +101,9 @@ private static void _introspect(Class> currType, Mapamount
* the getter would be amount()
)
* */
- USE_FIELD_NAME_GETTERS(true,true),
+ USE_FIELD_NAME_GETTERS(false,true),
/**
* Feature that enables use of public fields instead of setters and getters,
diff --git a/jr-test-module/src/test/groovy/GroovyRecordsTest.groovy b/jr-test-module/src/test/groovy/GroovyRecordsTest.groovy
index 468e31bb..0712cad2 100644
--- a/jr-test-module/src/test/groovy/GroovyRecordsTest.groovy
+++ b/jr-test-module/src/test/groovy/GroovyRecordsTest.groovy
@@ -11,7 +11,7 @@ class GroovyRecordsTest {
@Test
void testRecord() throws Exception {
- def json = JSON.std.asString(new Cow("foo", Mapamount
* the getter would be amount()
)
+ * @since 2.17
+ * @implNote Default state is false due to backward compatibility.
* */ - USE_FIELD_NAME_GETTERS(false,true), + USE_FIELD_MATCHING_GETTERS(false,true), /** * Feature that enables use of public fields instead of setters and getters, diff --git a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java index cdb09895..9b20bec6 100644 --- a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java +++ b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java @@ -13,7 +13,7 @@ import static com.fasterxml.jackson.jr.ob.JSON.Feature.INCLUDE_STATIC_FIELDS; -import static com.fasterxml.jackson.jr.ob.JSON.Feature.USE_FIELD_NAME_GETTERS; +import static com.fasterxml.jackson.jr.ob.JSON.Feature.USE_FIELD_MATCHING_GETTERS; /** * Helper class that jackson-jr uses by default to introspect POJO properties @@ -102,7 +102,7 @@ private static void _introspect(Class> currType, Mapamount
* the getter would be amount()
)
* @since 2.17
From 7b9566988fa865d893cfa21119628703e1253472 Mon Sep 17 00:00:00 2001
From: Shalnark <65479699+Shounaks@users.noreply.github.com>
Date: Sun, 10 Mar 2024 06:55:40 +0530
Subject: [PATCH 08/10] fix: remove now-redundant method
---
.../java/com/fasterxml/jackson/jr/ob/impl/POJODefinition.java | 4 ----
1 file changed, 4 deletions(-)
diff --git a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/POJODefinition.java b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/POJODefinition.java
index 8ddd5bf7..e14ee67b 100644
--- a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/POJODefinition.java
+++ b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/POJODefinition.java
@@ -176,10 +176,6 @@ public PropBuilder withIsGetter(Method m) {
_isGetter = m;
return this;
}
-
- public Field get_field() {
- return _field;
- }
}
}
From 3070e11794fe28e2ee09f4a65ee0ed108a1d298f Mon Sep 17 00:00:00 2001
From: Tatu Saloranta amount
- * the getter would be amount()
)
+ * the getter would be amount()
).
+ *
+ * @implNote Feature is disabled by default for backward compatibility.
+ * * @since 2.17 - * @implNoteDefault state is false due to backward compatibility.
- * */ + */ USE_FIELD_MATCHING_GETTERS(false,true), /** diff --git a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java index 8d0b5983..ef33e2b7 100644 --- a/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java +++ b/jr-objects/src/main/java/com/fasterxml/jackson/jr/ob/impl/BeanPropertyIntrospector.java @@ -1,19 +1,14 @@ package com.fasterxml.jackson.jr.ob.impl; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; +import java.lang.reflect.*; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; +import com.fasterxml.jackson.jr.ob.JSON; import com.fasterxml.jackson.jr.ob.impl.POJODefinition.Prop; import com.fasterxml.jackson.jr.ob.impl.POJODefinition.PropBuilder; -import static com.fasterxml.jackson.jr.ob.JSON.Feature.INCLUDE_STATIC_FIELDS; -import static com.fasterxml.jackson.jr.ob.JSON.Feature.USE_FIELD_MATCHING_GETTERS; - /** * Helper class that jackson-jr uses by default to introspect POJO properties * (represented as {@link POJODefinition}) to build general POJO readers @@ -100,15 +95,17 @@ private static void _introspect(Class> currType, Map