Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ protected Object _deserializeUsingPropertyBased(final JsonParser p, final Deseri
String propName = p.currentName();
p.nextToken(); // to point to value
final SettableBeanProperty creatorProp = creator.findCreatorProperty(propName);
//System.err.println("propName: "+propName+", prop: "+creatorProp+" (from "+creator.properties()+")");
// Object Id property?
if (buffer.readIdProperty(propName) && creatorProp == null) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;

import static org.junit.jupiter.api.Assertions.*;
Expand Down Expand Up @@ -83,6 +85,24 @@ public Value3252(@JsonProperty("name") String name,
}
}

// [databind#4310]
static final class Test4310
{
private final String value;

@ConstructorProperties("value")
public Test4310(@ImplicitName("somethingElse") String v) {
if (v == null) {
throw new IllegalArgumentException("Constructor called with null value");
}
value = v;
}

public String getValue() {
return value;
}
}

/*
/**********************************************************
/* Test methods
Expand Down Expand Up @@ -149,6 +169,20 @@ public void testSkipNonScalar3252() throws Exception
assertEquals(3, testData.size());
}

// [databind#4310]: use of ConstructorProperties with ParameterNames module
@Test
public void issue4310() throws Exception
{
ObjectMapper mapper = jsonMapperBuilder()
.annotationIntrospector(new AnnotationIntrospectorPair(
new ImplicitNameIntrospector(), new JacksonAnnotationIntrospector()))
.build();
String json = mapper.writeValueAsString(new Test4310("foo"));
//System.err.println("JSON: "+json);
Test4310 result = mapper.readValue(json, Test4310.class);
assertEquals("foo", result.getValue());
}

static class Something4908 {
@JsonProperty("value")
private final String _value;
Expand Down
Loading