Initial Values of Variables [was: Re: svn commit: r825875 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/cli: CommandLineOptions.java InputHandler.java]
Hi, Just a nit: +private boolean useCatalogResolver = false; +private EntityResolver entityResolver = null; +private URIResolver uriResolver = null; Those fields are being initialized to their default values. The Java Language Specification states [1] that every field must be initialized with a default value, basically 0 for numbers, false for booleans, and null for objects. So explicitly initializing them with their default values is just noise. I’d like to suggest everyone to remove those unnecessary initializations in the future. [1] http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.5 Thanks, Vincent
Re: Initial Values of Variables [was: Re: svn commit: r825875 - in /xmlgraphics/fop/trunk/src/java/org/apache/fop/cli: CommandLineOptions.java InputHandler.java]
Yep, they sure are. Does it hurt to spell it out? Like redundant parentheses, it does no harm, and makes the code just that little bit more explicit, for the dodos like me. Peter On 20/10/2009, at 8:13 PM, Vincent Hennebert wrote: Hi, Just a nit: +private boolean useCatalogResolver = false; +private EntityResolver entityResolver = null; +private URIResolver uriResolver = null; Those fields are being initialized to their default values. The Java Language Specification states [1] that every field must be initialized with a default value, basically 0 for numbers, false for booleans, and null for objects. So explicitly initializing them with their default values is just noise. I’d like to suggest everyone to remove those unnecessary initializations in the future. [1] http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.5 Thanks, Vincent