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

    https://github.com/apache/brooklyn-server/pull/408#discussion_r86738337
  
    --- Diff: 
camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
 ---
    @@ -144,7 +147,7 @@ public Entity call() throws Exception {
             
             protected Maybe<Entity> callImpl(boolean immediate) throws 
Exception {
                 Maybe<Entity> entityMaybe = getEntity(immediate);
    -            if (immediate && entityMaybe.isAbsent()) {
    +            if (immediate && entityMaybe.isAbsentOrNull()) {
    --- End diff --
    
    Is this to avoid the `NullPointerException` you saw before 
https://github.com/apache/brooklyn-server/pull/404 was merged? I wondered about 
this.
    
    The problem with returning `Maybe.of(null)` if the entity can't be resolved 
is that it's different semantics from `deferredSupplier.get()`. For the latter, 
it would throw `NoSuchElementException` with a nice message explaining it. Now 
this will just return a null.
    
    The intent is that `getImmediately()` will either return `absent()` if it 
can't be resolved immediately, or will return immediately exactly the same 
value as `get()` would.


---
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