Skip to content

Commit

Permalink
Fixed #2709 (java.util.Record support!)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 21, 2020
1 parent 263b544 commit dd2ed05
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,10 @@ Yona Appletree (Yona-Appletree@github)
property name is specified
(2.12.0)
Youri Bonnaffé (youribonnaffe@github)
* Contributed #2709: Support for JDK 14 record types
(2.12.0)
David Bidorff (bidorffOL@github)
* Reported, contributed fix for #2719: `FAIL_ON_IGNORED_PROPERTIES` does not throw
on `READONLY` properties with an explicit name
Expand Down
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Project: jackson-databind
#2683: Explicitly fail (de)serialization of `java.time.*` types in absence of
registered custom (de)serializers
#2707: Improve description included in by `DeserializationContext.handleUnexpectedToken()`
#2709: Support for JDK 14 record types
(contributed by Youri B)
#2719: `FAIL_ON_IGNORED_PROPERTIES` does not throw on `READONLY` properties with
an explicit name
(reported, fix contributed by David B)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ protected void _addDeserializerConstructors(DeserializationContext ctxt,
*/
protected void _addRecordConstructor(DeserializationContext ctxt,
BeanDescription beanDesc, CreatorCollector creators,
AnnotatedConstructor canonical, List<String> names)
AnnotatedConstructor canonical, List<String> implicitNames)
throws JsonMappingException
{
final int argCount = canonical.getParameterCount();
Expand All @@ -565,7 +565,10 @@ protected void _addRecordConstructor(DeserializationContext ctxt,
for (int i = 0; i < argCount; ++i) {
final AnnotatedParameter param = canonical.getParameter(i);
JacksonInject.Value injectable = intr.findInjectableValue(param);
final PropertyName name = PropertyName.construct(names.get(i));
PropertyName name = intr.findNameForDeserialization(param);
if (name == null || name.isEmpty()) {
name = PropertyName.construct(implicitNames.get(i));
}
properties[i] = constructCreatorProperty(ctxt, beanDesc, name, i, param, injectable);
}
creators.addPropertyCreator(canonical, false, properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonCreator.Mode;
import com.fasterxml.jackson.databind.AnnotationIntrospector;
import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.DeserializationConfig;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.deser.impl.CreatorCollector;
import com.fasterxml.jackson.databind.introspect.AnnotatedConstructor;
import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams;
import com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition;
import com.fasterxml.jackson.databind.introspect.VisibilityChecker;
import com.fasterxml.jackson.databind.util.ClassUtil;

/**
Expand Down

0 comments on commit dd2ed05

Please sign in to comment.