Skip to content

Commit 132c969

Browse files
authored
Exception when deserialization of private record with default constructor (fix for #4175) (#4178)
1 parent 3a0991c commit 132c969

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

release-notes/VERSION-2.x

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ Project: jackson-databind
9595
(fix contributed by Jonas K)
9696
#4159: Add new `DefaultTyping.NON_FINAL_AND_ENUMS` to allow Default Typing for `Enum`s
9797
(contributed by Joo-Hyuk K)
98+
#4175: Exception when deserialization of private record with default constructor
99+
(reported by Jan P)
100+
(contributed by Joo-Hyuk K)
98101

99102
2.15.4 (not yet released)
100103

src/main/java/com/fasterxml/jackson/databind/cfg/MapperConfigBase.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,8 @@ public final VisibilityChecker<?> getDefaultVisibilityChecker(Class<?> baseType,
844844
if (ClassUtil.isRecordType(baseType)) {
845845
// But only if creator auto-detection enabled:
846846
if (isEnabled(MapperFeature.AUTO_DETECT_CREATORS)) {
847-
vc = vc.withCreatorVisibility(Visibility.NON_PRIVATE);
847+
// [databind#4175] Changed Visibility from NON_PRIVATE to DEFAULT since 2.16
848+
vc = vc.withCreatorVisibility(Visibility.DEFAULT);
848849
}
849850
}
850851
}

src/test-jdk17/java/com/fasterxml/jackson/databind/failing/RecordPrivate4175Test.java renamed to src/test-jdk17/java/com/fasterxml/jackson/databind/jdk17/RecordPrivate4175Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.databind.failing;
1+
package com.fasterxml.jackson.databind.jdk17;
22

33
import java.util.Collections;
44

0 commit comments

Comments
 (0)