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

    https://github.com/apache/qpid-proton/pull/48#discussion_r36522483
  
    --- Diff: 
proton-j/src/main/java/org/apache/qpid/proton/engine/impl/CollectorImpl.java ---
    @@ -57,9 +58,16 @@ public void pop()
             }
         }
     
    -    public EventImpl put(Event.Type type, Object context)
    +    public EventImpl put(EventType type, Object context)
         {
    -        if (tail != null && tail.getType() == type &&
    +        if (type == null) {
    +            throw new IllegalArgumentException("Type cannot be null");
    +        }
    +        if (!type.isValid()) {
    +            throw new IllegalArgumentException("Cannot put events of type 
" + type);
    +        }
    +        // XXX: @gemmellr points out that type equality is wrong for event 
de-duplication. What about context equality?
    --- End diff --
    
    May now be wrong rather than definitely is wrong was my point, its now 
ambiguous due to the change to an interface for the event type...though I do 
wish I had just never bothered making the comment :)
    
    Context is probably more interesting, in that as it has been used it was to 
tie a particular proton object to a particular non-proton object for reference, 
so I can see there may be cases where you actually wouldnt want to de-dup for 
equivalent contexts and so using equals() instead of == could actually be wrong 
for the context.


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