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

    https://github.com/apache/brooklyn-server/pull/565#discussion_r106938814
  
    --- Diff: 
core/src/main/java/org/apache/brooklyn/core/objs/AbstractConfigurationSupportInternal.java
 ---
    @@ -138,18 +131,14 @@ public T call() {
             // getRaw returns Maybe(val) if the key was explicitly set (where 
val can be null)
             // or Absent if the config key was unset.
             Object unresolved = getRaw(key).or(key.getDefaultValue());
    -        final Object marker = new Object();
    -        // Give tasks a short grace period to resolve.
    -        Object resolved = Tasks.resolving(unresolved)
    +        Maybe<Object> resolved = Tasks.resolving(unresolved)
                     .as(Object.class)
    -                .defaultValue(marker)
                     .immediately(true)
                     .deep(true)
                     .context(getContext())
    -                .get();
    -        return (resolved != marker)
    -                ? TypeCoercions.tryCoerce(resolved, key.getTypeToken())
    -                        : Maybe.<T>absent();
    +                .getMaybe();
    +        if (resolved.isAbsent()) return 
Maybe.Absent.<T>castAbsent(resolved);
    +        return TypeCoercions.tryCoerce(resolved.get(), key.getTypeToken());
    --- End diff --
    
    I think we could, but not 100% sure.  There may be some corner cases and 
some lossiness between `as(Class<T>)` and `tryCoerce(..., TypeToken<T>)`.  Have 
added a comment.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to