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 b5e602cb..af983b86 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 @@ -117,7 +117,7 @@ private static void _introspect(Class currType, Map prop // 13-Jun-2015, tatu: Skip synthetic, bridge methods altogether, for now // at least (add more complex handling only if absolutely necessary) if (Modifier.isStatic(flags) - || m.isSynthetic() || m.isBridge()) { + || m.isSynthetic() || m.isBridge() || isGroovyMetaClass(m.getReturnType())) { continue; } Class argTypes[] = m.getParameterTypes(); diff --git a/jr-objects/src/test/java/com/fasterxml/jackson/jr/GroovyTest.groovy b/jr-objects/src/test/java/com/fasterxml/jackson/jr/GroovyTest.groovy index 16e2e63e..70a6e816 100644 --- a/jr-objects/src/test/java/com/fasterxml/jackson/jr/GroovyTest.groovy +++ b/jr-objects/src/test/java/com/fasterxml/jackson/jr/GroovyTest.groovy @@ -7,15 +7,52 @@ class GroovyTest extends TestBase { void testSimpleObject() throws Exception { var data = JSON.std.asString(new MyClass()) - var expected = "{\"aDouble\":0.0,\"aStr\":\"stringData\",\"anInt\":0,\"metaClass\":{}}"; + var expected = """{"AAAAA_A_Field_Starting_With_Two_Capital_Letters":"XYZ","aDouble":0.0,"aPublicInitializedInteger":56,"aPublicInitializedIntegerObject":1516,"aPublicUninitializedInteger":0,"anInitializedIntegerObject":1112,"anInitializedPublicString":"stringData","anInitializedString":"ABC","anInteger":0,"anIntegerWithValue":12}""" assertEquals(data, expected) } private class MyClass { - public int anInt; //testing groovy primitive - public String aStr = "stringData"; //testing allocated object + int anInteger + int anIntegerWithValue = 12 - public double aDouble; // - public Double aDoublesd; //testing boxing object + static int anStaticInteger = 34 + static int anStaticIntegerWithValue = 34 + + public int aPublicUninitializedInteger + public int aPublicInitializedInteger = 56 + + private int aPrivateUninitializedInteger + private int aPrivateInitializedInteger = 78 + + public static int aPublicStaticUninitializedInteger + public static int aPublicStaticInitializedInteger = 910 + + Integer anIntegerObject + Integer anInitializedIntegerObject = 1112 + + static Integer aStaticIntegerObject + static Integer aStaticInitializedIntegerObject = 1314 + + public Integer aPublicUninitializedIntegerObject + public Integer aPublicInitializedIntegerObject = 1516 + + public static Integer aPublicStaticUninitializedIntegerObject + public static Integer aPublicStaticInitializedIntegerObject = 1718 + + String aString + String anInitializedString = "ABC" + + static String aStaticString = "jacksonJR" + + public String aPublicString + public String anInitializedPublicString = "stringData" + + public String AAAAA_A_Field_Starting_With_Two_Capital_Letters = "XYZ" + //Other Items + public static String staticStr = "jacksonJR" // Public Static Object + static int anStaticInt // Uninitialized Static Object + public double aDouble // uninitialized primitive + public Double aDoubleObject // testing boxing object + private int hiddenvalue = 123 // private value } }