I just upgraded to CR3 and found out that the CacheListener interface has been removed in
favor for the annotationbased listener.
Some gripes:
1. Wouldn't this be considered a major api change(?) and as such should not go in
between two cr releases?
2. I understand that the benefit is that you can choose to declare only those listener
methods you are interested of, thus reducing the amount of empty boilerplate listener
methods. However, the downpart is that we are losing type safety here and I personally do
not consider this a good bargain.
From the documentation we can read:
anonymous wrote : Methods
annotated as such need to be public, have a void return type, and accept a single
parameter of type org.jboss.cache.notifications.event.Event or one of it's subtypes.
Now, isn't this exactly why we have interfaces? An interface enforces signature and
types. If we fail to honor the interface we get a nice compilation error, with the
annotation based model we will get runtime checking and runtime errors.
If we look at the list of available annotations here
http://labs.jboss.com/file-access/default/members/jbosscache/freezone/doc...
we can see that the input ot the methods differ. Now I have to switch between my IDE and
the documentation to lookup the annotation and what the proper signature is. Should I fail
to comply, my IDE will not tell me since there is no compile-time checking.
Furthermore, since there is no longer a CacheListener interface, I cannot use that
interface for listener-registration in layers created on top of the cache, forcing me
either into allowing Object or creating my own Listener interface which will allow me at
least some typesafety. But in the end I will never really know until the cache is started
and every possible listener has been registered to the cache, right?
Generally I'm not opposed annotations. I think they do fill a purpose, but I can't
seem understand the reasons for this particular design decision.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4064522#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...