Yes I put that validation in when I wrote most of the listener registration
code. It's purely artificial, serves no purpose and I've considered
removing the check that listeners are public. Just haven't done it since
there was no compelling reason in either direction so I just left it be.

TL;DR - I'm fine with removing the validation for public listeners.
On 17 Oct 2013 01:33, "Adrian Nistor" <notifications@github.com> wrote:

> In query/src/main/java/org/infinispan/query/backend/QueryInterceptor.java:
>
> > +      knownClassesScope = "QueryKnownClasses#" + cache.getName();
> > +   }
> > +
> > +   @Start
> > +   protected void start() {
> > +      clusterRegistry.addListener(knownClassesScope, registryListener);
> > +
> > +      for (Class<?> c : clusterRegistry.keys(knownClassesScope)) {
> > +         enableClass(c);
> > +      }
> > +   }
> > +
> > +   @Listener
> > +   public class KnownClassesRegistryListener {
> > +
> > +      KnownClassesRegistryListener() {
>
> The validation was clearly added on purpose. This is what happens if I
> make it private.
>
> Caused by: org.infinispan.notifications.IncorrectListenerException: Cache listener class org.infinispan.query.backend.QueryInterceptor$KnownClassesRegistryListener must be public!
>     at org.infinispan.notifications.AbstractListenerImpl.testListenerClassValidity(AbstractListenerImpl.java:153)
>     at org.infinispan.notifications.AbstractListenerImpl.validateAndAddListenerInvocation(AbstractListenerImpl.java:116)
>     at org.infinispan.notifications.cachelistener.CacheNotifierImpl.addListener(CacheNotifierImpl.java:438)
>     at org.infinispan.CacheImpl.addListener(CacheImpl.java:534)
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/infinispan/infinispan/pull/2152/files#r7003060>
> .
>