Skip to content

Commit

Permalink
Show that builder config resolution is broken in the presence of modu…
Browse files Browse the repository at this point in the history
…les, #1557
  • Loading branch information
Steven Schlansker committed Mar 15, 2017
1 parent e0ea4fc commit 47c0dac
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,31 @@ public ValueClass822(int x, Map<String,Object> stuff) {
}
}

protected static class NopModule1557 extends Module
{
@Override
public String getModuleName() {
return "NopModule";
}

@Override
public Version version() {
return Version.unknownVersion();
}

@Override
public void setupModule(SetupContext setupContext) {
// This annotation introspector has no opinion about builders, make sure it doesn't interfere
setupContext.insertAnnotationIntrospector(new NopAnnotationIntrospector() {
private static final long serialVersionUID = 1L;
@Override
public Version version() {
return Version.unknownVersion();
}
});
}
}

/*
/**********************************************************
/* Unit tests
Expand Down Expand Up @@ -359,4 +384,12 @@ public void testWithAnySetter822() throws Exception
assertTrue(ob instanceof List);
assertTrue(((List<?>) ob).isEmpty());
}

public void testPOJOConfigResolution1557() throws Exception
{
final String json = "{\"value\":1}";
MAPPER.registerModule(new NopModule1557());
ValueFoo value = MAPPER.readValue(json, ValueFoo.class);
assertEquals(1, value.value);
}
}

0 comments on commit 47c0dac

Please sign in to comment.