Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/brooklyn-server/pull/440#discussion_r91068402
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/config/internal/AbstractConfigMapImpl.java
 ---
    @@ -163,13 +163,18 @@ public ConfigBag getLocalConfigBag() {
             return putAllOwnConfigIntoSafely(ConfigBag.newInstance()).seal();
         }
     
    -    public Object setConfig(ConfigKey<?> key, Object v) {
    -        Object val = coerceConfigVal(key, v);
    +    public Object setConfig(final ConfigKey<?> key, Object v) {
    +        // Use our own key for writing, (e.g. in-case it should (or should 
not) be a structured key like MapConfigKey).
    +        // This is same logic as for getConfig, except we only have to 
look at our own container.
    +        ConfigKey<?> ownKey = getKeyAtContainer(getContainer(), key);
    +        if (ownKey==null) ownKey = key;
    +
    +        Object val = coerceConfigVal(ownKey, v);
    --- End diff --
    
    that's true @neykov re putting with a key with a different type to what you 
get with.  but it would be a weird thing to do to put with an incompatible key 
(normally we'll put with the same key or one which uses a supertype eg 
`Object`) and not surprising if it's coerced to int on get then double on put.  
given that this has been the behaviour, and catching errors early is useful, i 
definitely don't see a compelling reason to change.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to