question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BlackBird not support fluent setter

See original GitHub issue

Environment

  • 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:closed
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
wujimincommented, Jan 5, 2021

@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

<dependency>
  <groupId>com.fasterxml.jackson.modules</groupId>
  <artifactId>jackson-module-blackbird</artifactId>
</dependency>

groupId should be com.fasterxml.jackson.module

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found