classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] Nio-charset patch commited (Patch to String commited)


From: Roman Kennke
Subject: Re: [cp-patches] Nio-charset patch commited (Patch to String commited)
Date: Mon, 18 Apr 2005 13:20:02 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20021204

Sven,

-  public final char[] value;
+  private final char[] value;

  /**
   * Holds the number of characters in value.  This number is generally
   * the same as value.length, but can be smaller because substrings and
   * StringBuffers can share arrays. Package visible for use by trusted code.
   */
-  public final int count;
+  private final int count;

  /**
   * Caches the result of hashCode().  If this value is zero, the hashcode
@@ -132,7 +132,7 @@
   * substring()'s are common, the use of offset allows the operation
   * to perform in O(1). Package access is granted for use by StringBuffer.
   */
-  public final int offset;
+  private final int offset;

  /**
   * An implementation for address@hidden CASE_INSENSITIVE_ORDER}.

Bad idea, that breaks the build because StringBuffer is accessing this. Package private is better in this case. I fix this with the attached patch.

Generally when changing stuff in core libraries better RFC the list. And always check if it still builds.

2005-04-18  Roman Kennke  <address@hidden>

       * java/lang/String.java:
       Make value, offset and count fields package private instead
       of private.

/Roman

Index: java/lang/String.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/String.java,v
retrieving revision 1.63
diff -u -r1.63 String.java
--- java/lang/String.java       18 Apr 2005 10:11:45 -0000      1.63
+++ java/lang/String.java       18 Apr 2005 11:18:07 -0000
@@ -112,14 +112,14 @@
    * Characters which make up the String.
    * Package access is granted for use by StringBuffer.
    */
-  private final char[] value;
+  final char[] value;
 
   /**
    * Holds the number of characters in value.  This number is generally
    * the same as value.length, but can be smaller because substrings and
    * StringBuffers can share arrays. Package visible for use by trusted code.
    */
-  private final int count;
+  final int count;
 
   /**
    * Caches the result of hashCode().  If this value is zero, the hashcode
@@ -132,7 +132,7 @@
    * substring()'s are common, the use of offset allows the operation
    * to perform in O(1). Package access is granted for use by StringBuffer.
    */
-  private final int offset;
+  final int offset;
 
   /**
    * An implementation for address@hidden CASE_INSENSITIVE_ORDER}.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]