You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "David Rain (Jira)" <ji...@apache.org> on 2019/10/03 11:08:00 UTC

[jira] [Updated] (WICKET-6707) Property setter parameter type is assumed to be equal to getter return type

     [ https://issues.apache.org/jira/browse/WICKET-6707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Rain updated WICKET-6707:
-------------------------------
    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
{code:java}
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();
}
{code}
I have this getter and setter:
{code:java}
public boolean isInstantPayment() {
    return instantPayment == null ? false : instantPayment.booleanValue();
}

public void setInstantPayment(final Boolean instantPayment) {
    this.instantPayment = instantPayment;
}
{code}
So setting NULL *would be possible* (the property itself is object Boolean). Although it is not according to Java Beans specification.

  was:
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
{code:java}
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();
}
{code}
I have this getter and setter:
{code:java}
    public boolean isInstantPayment() {
        return instantPayment == null ? false : instantPayment.booleanValue();
    }    public void setInstantPayment(final Boolean instantPayment) {
        this.instantPayment = instantPayment;
    }
{code}
So setting NULL *would be possible* (the property itself is object Boolean). Although it is not according to Java Beans specification.


> Property setter parameter type is assumed to be equal to getter return type
> ---------------------------------------------------------------------------
>
>                 Key: WICKET-6707
>                 URL: https://issues.apache.org/jira/browse/WICKET-6707
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-core
>    Affects Versions: 8.6.1
>            Reporter: David Rain
>            Priority: Major
>
> 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
> {code:java}
> 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();
> }
> {code}
> I have this getter and setter:
> {code:java}
> public boolean isInstantPayment() {
>     return instantPayment == null ? false : instantPayment.booleanValue();
> }
> public void setInstantPayment(final Boolean instantPayment) {
>     this.instantPayment = instantPayment;
> }
> {code}
> So setting NULL *would be possible* (the property itself is object Boolean). Although it is not according to Java Beans specification.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)