diff --git a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanPropertyIntrospector.java b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanPropertyIntrospector.java index 1d5eae6d..2ed1f21f 100644 --- a/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanPropertyIntrospector.java +++ b/jr-objects/src/main/java/tools/jackson/jr/ob/impl/BeanPropertyIntrospector.java @@ -114,10 +114,8 @@ private static void _introspect(Class currType, Map prop // then public fields (since 2.8); may or may not be ultimately included // but at this point still possible for (Field f : currType.getDeclaredFields()) { - if (fieldNameMap != null) { - fieldNameMap.put(f.getName(), f); - } - if (!Modifier.isPublic(f.getModifiers()) || f.isEnumConstant() || f.isSynthetic()) { + // First things first: skip synthetics, Enum constants + if (f.isEnumConstant() || f.isSynthetic()) { continue; } // Only include static members if (a) inclusion feature enabled and @@ -125,7 +123,13 @@ private static void _introspect(Class currType, Map prop if (Modifier.isStatic(f.getModifiers()) && (noStatics || Modifier.isFinal(f.getModifiers()))) { continue; } - _propFrom(props, f.getName()).withField(f); + // But for possible renaming, even non-public Fields have effect so: + if (fieldNameMap != null) { + fieldNameMap.put(f.getName(), f); + } + if (Modifier.isPublic(f.getModifiers())) { + _propFrom(props, f.getName()).withField(f); + } } // then get methods from within this class