dev@jax-ws.java.net

So many final classes

From: Peter Hendry <peter.hendry_at_capeclear.com>
Date: Sun, 15 Apr 2007 15:44:16 +1200

I was wondering why so many classes in the RI are "final"? Obviously
this prevents them being extended. Classes like WSServlet and
WSServletDelegate where both of these seem like ideal places to add
functionality. WSServlet is defined in web.xml so is easily changed
through configuration, and because WSServlet relies on getting an
instance of WSServletDelegate which is set by the listener, it means a
new listener cannot set a different class for WSServletDelegate and so
it could not use WSServlet if it did wish to change WSServletDelegate
through extension.

Doing a quick search through the 2.1.1 RI source code there appear to be
123 usages of "public final class". Is there a specific reason for being
so restrictive on what can be extended? This could be quite limiting for
adding functionality over existing functionality.

Is this to prevent extension of the RI other than through the SPI
points? If so then I would suggest that it presupposes that there are
adequate SPI points and that they are well enough defined to expose any
new functionality.

Pete