You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/06/26 10:11:20 UTC

[jira] [Resolved] (WICKET-5252) PropertyResolver breaks immutable objects by calling setAccessible

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

Martin Grigorov resolved WICKET-5252.
-------------------------------------

    Resolution: Won't Fix

PropertyModel's javadoc explains that:

 * Note that the property resolver by default provides access to private members and methods. If
 * guaranteeing encapsulation of the target objects is a big concern, you should consider using an
 * alternative implementation.

As I said earlier - you should not use PropertyModel if you want to use immutable model object. You can use AbstractReadOnlyModel if you want just read access.
                
> PropertyResolver breaks immutable objects by calling setAccessible
> ------------------------------------------------------------------
>
>                 Key: WICKET-5252
>                 URL: https://issues.apache.org/jira/browse/WICKET-5252
>             Project: Wicket
>          Issue Type: Bug
>    Affects Versions: 6.8.0
>            Reporter: Daniel Zwicker
>
> If a Bean only have private fields and no setter this object is immutable. The decision to implement such an object has a bunch of implications. e.g. it is thread safe, you can take snapshots of these object to store a version history and so on.
> Now your use of reflection breaks this isolation silently. I believe if somebody want set the values of the object he should implement a setter or provide a public field.   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira