You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "johan zahri (JIRA)" <ji...@apache.org> on 2015/06/03 13:57:50 UTC

[jira] [Resolved] (BEANUTILS-476) copy derived properties not working when parent class attribute is public

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

johan zahri resolved BEANUTILS-476.
-----------------------------------
    Resolution: Invalid

Turned out that when the property type does not match it is ignored.
i.e. when c.x has different type than that of b.x it is ignored

> copy derived properties not working when parent class attribute is public
> -------------------------------------------------------------------------
>
>                 Key: BEANUTILS-476
>                 URL: https://issues.apache.org/jira/browse/BEANUTILS-476
>             Project: Commons BeanUtils
>          Issue Type: Bug
>    Affects Versions: 1.9.2
>         Environment: JDK 7
>            Reporter: johan zahri
>
> In my case, I have a class B that extends A. property x defined as public in A but overridden as private in B with getters and setter defined as public.
> When performing a BeanUtils.copyProperties operation on instance of B as the source, the value of the target copies the value coming from A rather than from B which has a public getter and setter.
> I would assume that this should not be the correct behaviour?
> eg:
> A{public x;}
> B extends A
> {private x;public getX();public setX(x);}
> ((A)b).x=null
> b.x="val"
> BeanUtils.copyProperties (c,b);
> Result : c.x=null
> Expected: c.x="val"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)