cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylvain.wal...@anyware-tech.com>
Subject Re: svn commit: r123903 - in cocoon/branches/BRANCH_2_1_X/src: blocks/batik/java/org/apache/cocoon/components/transcoder blocks/batik/java/org/apache/cocoon/components/url blocks/fop/java/org/apache/cocoon/components/renderer blocks/fop/java/org/apache/cocoon/serialization blocks/portal/java/org/apache/cocoon/portal/impl blocks/portal/java/org/apache/cocoon/portal/pluto blocks/scratchpad/java/org/apache/cocoon/generation java/org/apache/cocoon/components/classloader java/org/apache/cocoon/generation java/org/apache/cocoon/xml/dom
Date Mon, 03 Jan 2005 09:58:06 GMT
antonio@apache.org wrote:

>Author: antonio
>Date: Sun Jan  2 13:26:59 2005
>New Revision: 123903
>
>URL: http://svn.apache.org/viewcvs?view=rev&rev=123903
>Log:
>Set static variable as final
>  
>

Why should all static variables be final? This is necessary for public 
constants, but not for internal variables. Although this changes nothing 
for variables initialized when declared (e.g. "private static Map map = 
new HashMap()"), it IMO reduces readability when the initialization 
involves several steps in a static block as below:

>     /** Batik's original default handler */        
>-    protected static ParsedURLProtocolHandler defaultHandler;
>+    protected final static ParsedURLProtocolHandler defaultHandler = ParsedURL.getHandler(null);
// Keep the default handler, if any
> 
>     /**
>      * Change the default handler used by Batik to resolve URLs to a handler
>@@ -56,9 +56,6 @@
>      * @param logger the logger for logging.
>      */
>     static {        
>-        // Keep the default handler, if any
>-        SourceProtocolHandler.defaultHandler = ParsedURL.getHandler(null);
>-
>         // Set the default handler to our handler
>         ParsedURL.registerHandler(new SourceProtocolHandler(null));
>  
>

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message