Skip to content

Commit

Permalink
Change master to be 2.5.0-SNAPSHOT
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 13, 2014
1 parent 64a27bc commit cc9623e
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 30 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.4.2-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
<name>jackson-databind</name>
<packaging>bundle</packaging>
<description>General data-binding functionality for Jackson: works on core streaming API</description>
Expand Down Expand Up @@ -69,12 +69,12 @@ javax.xml.datatype, javax.xml.namespace, javax.xml.parsers
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.4.0</version>
<version>2.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.4.1.1</version>
<version>2.5.0-SNAPSHOT</version>
</dependency>

<!-- and for testing we need a few libraries
Expand Down Expand Up @@ -125,8 +125,8 @@ javax.xml.datatype, javax.xml.namespace, javax.xml.parsers
<configuration>
<links>
<link>http://docs.oracle.com/javase/6/docs/api/</link>
<link>http://fasterxml.github.com/jackson-annotations/javadoc/2.4/</link>
<link>http://fasterxml.github.com/jackson-core/javadoc/2.4/</link>
<link>http://fasterxml.github.com/jackson-annotations/javadoc/2.5/</link>
<link>http://fasterxml.github.com/jackson-core/javadoc/2.5/</link>
</links>
</configuration>
</plugin>
Expand Down
22 changes: 7 additions & 15 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
Project: jackson-databind
Version: 2.4.2 (xx-Aug-2014)

#506: Index is never set for Collection and Array in InvalidFormatException.Reference
(reported by Fabrice D, fabdouglas@github)
- Fixed a problem related to [jackson-dataformat-smile#19].
Version: 2.5.0 (xx-xxx-2014)

------------------------------------------------------------------------
=== History: ===
------------------------------------------------------------------------

2.4.1.2 (12-Jul-2014)

Special one-off "micro patch" for:

#503: Concurrency issue inside com.fasterxml.jackson.databind.util.LRUMap.get(Object)
(reported by fjtc@github)

2.4.1.1 (18-Jun-2014)

Special one-off "micro patch" for:
2.4.2 (xx-Aug-2014)

#491: Temporary work-around for issue #490 (full fix for 2.5 needs to be
in `jackson-annotations`)
#503: Concurrency issue inside com.fasterxml.jackson.databind.util.LRUMap.get(Object)
(reported by fjtc@github)
#506: Index is never set for Collection and Array in InvalidFormatException.Reference
(reported by Fabrice D, fabdouglas@github)
- Fixed a problem related to [jackson-dataformat-smile#19].

2.4.1 (17-Jun-2014)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ public ValueInstantiator _valueInstantiatorInstance(DeserializationConfig config

for (AnnotatedConstructor ctor : beanDesc.getConstructors()) {
int argCount = ctor.getParameterCount();
boolean isCreator = intr.hasCreatorAnnotation(ctor) || ctor == propertyCtor;
boolean isCreator = intr.hasCreatorAnnotation(ctor) || (ctor == propertyCtor);
// boolean isCreator = intr.hasCreatorAnnotation(ctor);

boolean isVisible = vchecker.isCreatorVisible(ctor);
// some single-arg constructors (String, number) are auto-detected
if (argCount == 1) {
Expand Down Expand Up @@ -473,15 +475,15 @@ protected boolean _handleSingleArgumentConstructor(DeserializationContext ctxt,
PropertyName name)
throws JsonMappingException
{
// note: if we do have parameter name, it'll be "property constructor":
// note: if we do have EXPLICIT parameter name, it'll be "property constructor":
AnnotatedParameter param = ctor.getParameter(0);
if (name == null) {
name = _findParamName(param, intr);
name = _findExplicitParamName(param, intr);
}
Object injectId = intr.findInjectableValueId(param);

if ((injectId != null) || (name != null && name.hasSimpleName())) { // property-based
// We know there's a name and it's only 1 parameter.
// We know there's EXPLICIT name and it's only 1 parameter.
CreatorProperty[] properties = new CreatorProperty[1];
properties[0] = constructCreatorProperty(ctxt, beanDesc, name, 0, param, injectId);
creators.addPropertyCreator(ctor, properties);
Expand Down Expand Up @@ -547,7 +549,8 @@ protected boolean _handleSingleArgumentConstructor(DeserializationContext ctxt,
// some single-arg factory methods (String, number) are auto-detected
if (argCount == 1) {
AnnotatedParameter param = factory.getParameter(0);
PropertyName pn = _findParamName(param, intr);
// NOTE: only consider EXPLICIT names for auto-detection
PropertyName pn = _findExplicitParamName(param, intr);
String name = (pn == null) ? null : pn.getSimpleName();
Object injectId = intr.findInjectableValueId(param);

Expand Down Expand Up @@ -708,7 +711,7 @@ protected CreatorProperty constructCreatorProperty(DeserializationContext ctxt,
}
return prop;
}

protected PropertyName _findParamName(AnnotatedParameter param, AnnotationIntrospector intr)
{
if (param != null && intr != null) {
Expand All @@ -726,6 +729,23 @@ protected PropertyName _findParamName(AnnotatedParameter param, AnnotationIntros
}
return null;
}

protected PropertyName _findExplicitParamName(AnnotatedParameter param, AnnotationIntrospector intr)
{
if (param != null && intr != null) {
return intr.findNameForDeserialization(param);
}
return null;
}

protected boolean _hasExplicitParamName(AnnotatedParameter param, AnnotationIntrospector intr)
{
if (param != null && intr != null) {
PropertyName n = intr.findNameForDeserialization(param);
return (n != null) && n.hasSimpleName();
}
return false;
}

/*
/**********************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.introspect.AnnotatedMember;
import com.fasterxml.jackson.databind.introspect.AnnotatedParameter;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;

public class TestCreators3 extends BaseMapTest
{
Expand All @@ -17,7 +20,7 @@ static MultiCtor factory(@JsonProperty("a") String a, @JsonProperty("b") String

private MultiCtor() { }

private MultiCtor(String a, String b, Object c) {
private MultiCtor(String a, String b, Boolean c) {
if (c == null) {
throw new RuntimeException("Wrong factory!");
}
Expand All @@ -26,19 +29,39 @@ private MultiCtor(String a, String b, Object c) {
}

}

@SuppressWarnings("serial")
static class MyParamIntrospector extends JacksonAnnotationIntrospector
{
@Override
public String findImplicitPropertyName(AnnotatedMember param) {
if (param instanceof AnnotatedParameter) {
AnnotatedParameter ap = (AnnotatedParameter) param;
switch (ap.getIndex()) {
case 0: return "a";
case 1: return "b";
case 2: return "c";
default:
return "param"+ap.getIndex();
}
}
return super.findImplicitPropertyName(param);
}
}

/*
/**********************************************************
/* Test methods
/**********************************************************
*/

private final ObjectMapper MAPPER = new ObjectMapper();

// [Issue#421]
public void testMultiCtor421() throws Exception
{
MultiCtor bean = MAPPER.readValue(aposToQuotes("{'a':'123','b':'foo'}"), MultiCtor.class);
final ObjectMapper mapper = new ObjectMapper();
mapper.setAnnotationIntrospector(new MyParamIntrospector());

MultiCtor bean = mapper.readValue(aposToQuotes("{'a':'123','b':'foo'}"), MultiCtor.class);
assertNotNull(bean);
assertEquals("123", bean._a);
assertEquals("foo", bean._b);
Expand Down

0 comments on commit cc9623e

Please sign in to comment.