Also added by Eclipse (same bug). It serves no purpose, but isn't wrong either. Both equals overrides can be removed. Predicate#equals explains you can override equals if you need to, but these predicates are not meant to be kept and/or compared to other predicates. The Eclipse bug caused all methods of the implemented interfaces to be added automatically with the complete signature of these methods. Predicate also defines equals (to add some javadoc), which caused Eclipse to add the method to your class automatically. I forgot to remove them back then.
Best regards, Emond On Wed, Mar 5, 2014 at 7:36 PM, Martin Grigorov <[email protected]>wrote: > What about the #equals() ? > > Martin Grigorov > Wicket Training and Consulting > > > On Wed, Mar 5, 2014 at 8:20 PM, Emond Papegaaij > <[email protected]>wrote: > > > These annotations are wrong and should be removed. Thanks for noticing. > > Eclipse had a tendency to automatically set these annotations. This bug > is > > fixed by now, but these classes were written when Eclipse still had the > > bug. The Predicate interface states that it is allowed to throw a > > NullPointerException when a predicate does not allow null. These > > predicactes (like most) do not make sense when passed null, and should > > therefore throw NPE and should not have the @Nullable annotation. Note > that > > this violates the Liskov substitution principal, but it's still according > > to the documentation :). IMHO Guava should not have allowed null in > > Predicate and have a subinterface that does allow null. > > > > Best regards, > > Emond > > > > > > On Wed, Mar 5, 2014 at 4:59 PM, Martin Grigorov <[email protected] > > >wrote: > > > > > Hi Emond, > > > > > > I see you have used javax.annotation.Nullable at > > > > > > > > > https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventFilter.java?source=c#L44 > > > > > > The tiny bit that bothers me is that the parameter is annotated to be > > able > > > to be null but then you use it directly without check for null. Should > we > > > add the check or change the annotation with javax.annotation.Nonnull ? > > > > > > While here - what is the purpose of #equals() override at > > > > > > > > > https://github.com/apache/wicket/blob/master/wicket-experimental/wicket-atmosphere/src/main/java/org/apache/wicket/atmosphere/EventFilter.java?source=c#L52 > > > ? > > > Same in org.apache.wicket.atmosphere.NoFilterPredicate > > > > > > Martin Grigorov > > > Wicket Training and Consulting > > > > > >
