StringBuffer patch.

Mo DeJong mdejong at cygnus.com
Sat Apr 1 04:53:16 PST 2000


Hello.

Between revisions 1.11 and 1.12 of
libraries/javalib/java/lang/StringBuffer.java
the access of the StringBuffer.ensureCapacity(int)V method was changed
from public to private.

+private void ensureCapacity(int minCapacity) {
+       if (minCapacity <= 0)
+               return;
+       synchronized (this) {
+               ensureCapacity(minCapacity, false);
+       }
 }
 
-public synchronized void ensureCapacity ( int minimumCapacity ) {
-       int    n;
-       char[] oldBuffer;
+// This method assumes synchronization



This was an error, the method should be public. The change generated
errors like the following in my code.

l:/home/mo/project/kaffe/install/share/kaffe/Klasses.jar \
/home/mo/bin/jikes -g \
        -d /home/mo/project/tcljava/unix/Kaffe/jacl \
                tcl/lang/*.java sunlabs/brazil/util/regexp/*.java

Found 6 semantic errors compiling "tcl/lang/FileUtil.java":

    89.     absBuf.ensureCapacity(absBuf.length() + path.length());
            <---------------------------------------------------->
*** Error: Method "void ensureCapacity(int $1);" in class
"java/lang/StringBuffer" has private access. Therefore, it is not
accessible in class "tcl/lang/FileUtil".




The following patch fixes the problem.


Sat Apr  1 08:00:00 PST 2000  Mo DeJong <mdejong at cygnus.com>

        * libraries/javalib/java/lang/StringBuffer.java: fixed
        problem with ensureCapacity() method, it was accidently
        changed to private access when it should have been public.



Index: libraries/javalib/java/lang/StringBuffer.java
===================================================================
RCS file: /cvs/kaffe/kaffe/libraries/javalib/java/lang/StringBuffer.java,v
retrieving revision 1.12
diff -u -r1.12 StringBuffer.java
--- libraries/javalib/java/lang/StringBuffer.java       2000/03/31
23:29:59    1.12
+++ libraries/javalib/java/lang/StringBuffer.java       2000/04/01
12:43:13
@@ -104,7 +104,7 @@
        }
 }
 
-private void ensureCapacity(int minCapacity) {
+public void ensureCapacity(int minCapacity) {
        if (minCapacity <= 0)
                return;
        synchronized (this) {



Mo Dejong
Red Hat Inc.



More information about the kaffe mailing list