Mark Phippard wrote:
> On Fri, May 23, 2008 at 6:18 PM, Blair Zajac <blair_at_orcaware.com> wrote:
>> markphip_at_tigris.org wrote:
>>> Author: markphip
>>> Date: Fri May 23 12:45:46 2008
>>> New Revision: 31402
>>>
>>> Log:
>>> JavaHL: Followup to r31273. Create a LogDate class that
>>> performs the parsing of our date string into microseconds.
>>> Includes convenience methods for getting the date in various
>>> formats.
>>>
>>> +public class LogDate implements java.io.Serializable
>>> +{
>>> + private static final long serialVersionUID = 1L;
>>> + private static final DateFormat formatter = new SimpleDateFormat(
>>> + "yyyy-MM-dd'T'HH:mm:ss.SSS");
>>> +
>>> + private long timeMicros;
>>> + private String cachedString;
>>> + private Calendar cachedDate;
>> Shouldn't these three be final?
>
> I've never declared class member variables that way. Does it bring
> some kind of benefit? Does it work because the variables are only set
> once? What about the long, doesn't it implicitly default to 0. If it
> is final could it then be changed to a value?
>
> I am not against adding final, just do not see that it adds anything.
Given that the value never changes after assignment, using final makes it clear
and also adds a tiny performance benefit.
Blair
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-05-24 03:08:16 CEST