Skip to content

BlackBird not support fluent setter #123

@wujimin

Description

@wujimin

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 [email protected]/java.lang.invoke.AbstractValidatingLambdaMetafactory.checkDescriptor(AbstractValidatingLambdaMetafactory.java:308)
	at [email protected]/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:294)
	at [email protected]/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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions