Skip to content

Commit e975c9b

Browse files
committed
Outgoing processing
1 parent b4bf736 commit e975c9b

File tree

1 file changed

+9
-3
lines changed
  • src/main/kotlin/com/fasterxml/jackson/module/kotlin/deser/value_instantiator/creator

1 file changed

+9
-3
lines changed

src/main/kotlin/com/fasterxml/jackson/module/kotlin/deser/value_instantiator/creator/ValueCreator.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,20 @@ internal sealed class ValueCreator<T> {
2929

3030
fun generateBucket(): ArgumentBucket = bucketGenerator.generate()
3131

32+
private val accessibilityChecker: (DeserializationContext) -> Boolean by lazy {
33+
return@lazy if (isAccessible) {
34+
{ ctxt -> ctxt.config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS) }
35+
} else {
36+
{ ctxt -> ctxt.config.isEnabled(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS) }
37+
}
38+
}
39+
3240
/**
3341
* Checking process to see if access from context is possible.
3442
* @throws IllegalAccessException
3543
*/
3644
fun checkAccessibility(ctxt: DeserializationContext) {
37-
if ((!isAccessible && ctxt.config.isEnabled(MapperFeature.CAN_OVERRIDE_ACCESS_MODIFIERS)) ||
38-
(isAccessible && ctxt.config.isEnabled(MapperFeature.OVERRIDE_PUBLIC_ACCESS_MODIFIERS))
39-
) {
45+
if (accessibilityChecker(ctxt)) {
4046
return
4147
}
4248

0 commit comments

Comments
 (0)