Skip to content

Commit

Permalink
Fix #4
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 12, 2016
1 parent f78ae9f commit a5334c8
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 7 deletions.
3 changes: 1 addition & 2 deletions afterburner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ field access and method calls
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
<scope>compile</scope>
<version>${version.asm}</version>
</dependency>
<dependency> <!-- tests use Jackson annoations -->
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,13 @@ protected PropertyAccessorCollector findProperties(Class<?> beanClass,
continue;
}

Class<?> type = bpw.getType().getRawClass();
// 11-Apr-2016, tatu: Actually we have to consider actual physical type
// of accessor, not just logical type, see [afterburner#4]; generic
// types
// Class<?> type = bpw.getType().getRawClass();
Class<?> type = bpw.getMember().getRawType();
boolean isMethod = (member instanceof AnnotatedMethod);

if (type.isPrimitive()) {
if (type == Integer.TYPE) {

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.fasterxml.jackson.module.afterburner.deser;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.afterburner.AfterburnerTestBase;

public class GenericPropertyDeserializationTest extends AfterburnerTestBase
{
static abstract class AbstractMyClass<ID> {
private ID id;

AbstractMyClass() { }

public ID getId() {
return id;
}

public void setId(ID id) {
this.id = id;
}
}

public static class MyClass extends AbstractMyClass<String> {
public MyClass() { }
}

/*
/**********************************************************
/* Unit tests
/**********************************************************
*/

final private ObjectMapper MAPPER = mapperWithModule();

public void testGenericIssue4() throws Exception
{
MyClass result = MAPPER.readValue("{\"id\":\"foo\"}", MyClass.class);
assertEquals("foo", result.getId());
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.fasterxml.jackson.module.afterburner.failing;
package com.fasterxml.jackson.module.afterburner.ser;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.afterburner.AfterburnerTestBase;

public class GenericSerialize4Test extends AfterburnerTestBase
public class GenericPropertySerializationTest extends AfterburnerTestBase
{
public static abstract class AbstractMyClass<ID> {

Expand Down
3 changes: 1 addition & 2 deletions mrbean/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ ${project.groupId}.mrbean.*;version=${project.version}
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.4</version>
<scope>compile</scope>
<version>${version.asm}</version>
</dependency>
</dependencies>

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ not datatype, data format, or JAX-RS provider modules.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.jackson.core>2.7.4-SNAPSHOT</version.jackson.core>
<version.asm>5.1</version.asm>
</properties>

<build>
Expand Down
4 changes: 4 additions & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ Modules:

2.7.4 (not yet released)

#4: (afterburner) Serialization with Afterburner causes Java VerifyError for
generic with String as type
(reported by imfuraisoth@github)
#8 (mrbean): Problem with `Optional<T>`, `AtomicReference<T>` valued properties
(reported by Thomas V)
- Upgrade to Asm 5.1 for mr-bean, afterburner

2.7.3 (16-Mar-2016)
2.7.2 (26-Feb-2016)
Expand Down

0 comments on commit a5334c8

Please sign in to comment.