Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-6707

Property setter parameter type is assumed to be equal to getter return type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 8.6.1
    • 8.7.0, 9.0.0-M4, 7.16.0
    • wicket-core
    • None

    Description

      I am getting error: Method [public boolean cz.kb.dcs.module_transaction.api.data_objects.cexi.TransactionFormItem.isInstantPayment()]. Can't convert null value to a primitive class: boolean

      This is due to

      if (setMethod != null) {
          // getMethod is always there and if the value will be set through a setMethod then
          // the getMethod return type will be its type. Else we have to look at the
          // parameters if the setter but getting the return type is quicker
          type = getMethod.getReturnType();
      }
      

      I have this getter and setter:

      public boolean isInstantPayment() {
          return instantPayment == null ? false : instantPayment.booleanValue();
      }
      
      public void setInstantPayment(final Boolean instantPayment) {
          this.instantPayment = instantPayment;
      }
      

      So setting NULL would be possible (the property itself is object Boolean). Although it is not according to Java Beans specification.

      Attachments

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            davesman David Rain
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: