BlackBird not support fluent setter
See original GitHub issueEnvironment
- jdk 11
- jackson 2.12.0 with BlackBird
Reproduce case
define a model with fluent setter
public class BlackBirdBug {
public static class Model {
private int value = 10;
public int getValue() {
return value;
}
public Model setValue(int value) {
this.value = value;
return this;
}
}
public static void main(String[] args) throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper()
.registerModule(new BlackbirdModule());
String json = mapper.writeValueAsString(new Model());
System.out.println(json);
Model model = mapper.readValue(json, Model.class);
System.out.println(model.getValue());
}
}
will throw exception:
Caused by: java.lang.invoke.LambdaConversionException: Type mismatch for instantiated parameter 1: int is not a subtype of class java.lang.Object
at java.base@11.0.6/java.lang.invoke.AbstractValidatingLambdaMetafactory.checkDescriptor(AbstractValidatingLambdaMetafactory.java:308)
at java.base@11.0.6/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:294)
at java.base@11.0.6/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:328)
at com.fasterxml.jackson.module.blackbird.deser.BBDeserializerModifier.createSetter(BBDeserializerModifier.java:221)
at com.fasterxml.jackson.module.blackbird.deser.BBDeserializerModifier.nextProperty(BBDeserializerModifier.java:179)
at com.fasterxml.jackson.module.blackbird.deser.BBDeserializerModifier.findOptimizableProperties(BBDeserializerModifier.java:126)
... 14 more
we are trying switch from AfterBurner to BlackBird, because AfterBurner not support ToStringSerializer
via @JsonSerialize
in boolean
oroperty
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
Fluent setter: breaking the convention | by Sergey Chernov
To do this, set a new field, and then from the context menu select Code > Generate > Setter: From Template select Builder:...
Read more >jackson-module-guice-2.13.3-9.99.noarch.rpm openSUSE ...
TimeZone' * 2.12.1 (08-Jan-2021) + #120: Afterburner does not support the new CoercionConfig + #123: BlackBird not support fluent setter * 2.12.0 ...
Read more >Using @Setter and @Accessors(fluent = true) together
And it's really useful, as pointed out below, you don't break the bean standard but you can still use the fluent setters.
Read more >Students in Service
Many service opportunities exist through other student clubs and organizations, as well as through various programs of study and King's NCAA athletics programs....
Read more >Jean Ingelow.
That women can write poetry, and poetry of a very high order, no one who has ... Flattery has made women Juno-eyed, with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Happy new year
https://github.com/apache/servicecomb-java-chassis/blob/master/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/LambdaMetafactoryUtils.java#L131
commit: https://github.com/apache/servicecomb-java-chassis/commit/d0655d76fb5cd765a7a91ffb07241c23250704a4#diff-1bddb21d3057a94ecd88f453fd874a04f13dc1ae4b5093f6c1e9838fdb576246
We also had this problem most six months ago, and we just force set the return type to void to avoid the problem
@stevenschlansker i have verified the new code
it fixed my issue.
thanks.
and find a new issue of https://github.com/FasterXML/jackson-modules-base/blob/2.12/blackbird/README.md
groupId should be
com.fasterxml.jackson.module