Problem with StringBuffer
Archie Cobbs
archie at whistle.com
Tue Apr 4 14:47:03 PDT 2000
Artur Biesiadowski writes:
> > // Note: value, offset, and count are not private, because
> > // StringBuffer uses them for faster access
> > - char[] value;
> > - int offset;
> > - int count;
> > + char[] value; // really "final"
> > + int offset; // really "final"
> > + int count; // really "final"
>
>
> And why these fields are not in fact final ? They are assigned to only
> in constructor so they could be safely marked as final. I don't suppose
> it will make any difference in speed with current jit, but it would be
> selfdocumenting code - plus possibility of catching some bug early
> during String changes/optimalizations.
Does this answer your question? :-)
$ jikes String.java
332. value = str.value;
<--->
*** Error: Possible attempt to reassign a value to the final variable "value".
334. count = str.count;
<--->
*** Error: Possible attempt to reassign a value to the final variable "count".
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
More information about the kaffe
mailing list