zwaldeck / mollie

Java framework to consume the Mollie API
Other
39 stars 37 forks source link

PaymentResponse.isCancelable always has value "false" after deserialization #45

Closed giova333 closed 3 years ago

giova333 commented 4 years ago

I noticed that the value of PaymentResponse.isCancelable is always false event if the value of json field is true. Since you are using Lombok I decided to analyze the class file:

public class PaymentResponse  {
  private boolean isCancelable;

  public boolean isCancelable() {
        return this.isCancelable;
    }
  public void setCancelable(boolean isCancelable) {
        this.isCancelable = isCancelable;
    }
}

Considering that the name of json field is : "isCancelable": true the name of the setter doesn't fit into Jackson serialization mechanism because, as I can imagine, it is trying to find the setter method called setIsCancelable rather than setCancalable and because such method doesn't exist, the setter is never called. The way how setters are generated it's a specific behavior and apparently, Lombok team doesn't consider it as a bug, it's just a design decision, however, it's affecting your library

zwaldeck commented 3 years ago

Thanks @giova333 for the investigation!

I will add a setter with the correct naming as a fix. Quite dirty but that's a drawback for using Lombok I guess

zwaldeck commented 3 years ago

Deployed in version 3.1.0