On Wed, 22 Oct 2025 20:31:19 GMT, Roger Riggs <[email protected]> wrote:

>> Xueming Shen has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   test case update
>
> src/java.base/share/classes/jdk/internal/lang/CaseFolding.java.template line 
> 26:
> 
>> 24:  */
>> 25: 
>> 26: package jdk.internal.java.lang;
> 
> Please use the jdk.internal.lang package. (And adjust 
> GensrcCharacterData.gmk).

updated

> src/java.base/share/classes/jdk/internal/lang/CaseFolding.java.template line 
> 57:
> 
>> 55:      * @see #fold(int)
>> 56:      */
>> 57:          public static boolean isFolded(int cp) {
> 
> The name `isFolded` can be confusing, it implies there is a mapping needed, 
> but it is the opposite.
> I'd suggest suggest keeping only `isDefined` and perhaps rename to `hasFold` 
> or similar.

removed. not really used. isDefined() is being used.

> src/java.base/share/classes/jdk/internal/lang/CaseFolding.java.template line 
> 93:
> 
>> 91:         if (entry != null)
>> 92:           return entry.folding;
>> 93:         return new int[] { cp };
> 
> Creating a bunch of small arrays is very wasteful.  Single char to single 
> char should not need an allocation.

this is not really being used by the string class, for now. removed

> src/java.base/share/classes/jdk/internal/lang/CaseFolding.java.template line 
> 131:
> 
>> 129:      * @return a {@code String} containing the case-folded form of the 
>> input string
>> 130:      */
>> 131:     public static String fold(String s) {
> 
> Save this unused method for another PR. (and the corresponding tests)

removed to the test case as a helper method

> src/java.base/share/classes/jdk/internal/lang/CaseFolding.java.template line 
> 280:
> 
>> 278:         }
>> 279: 
>> 280:         private void add(CaseFoldingEntry entry) {
> 
> CDS can map whole objects/data structures into the heap; consider how to make 
> this data structure so it can be mapped and not re-computed each startup.

updated to use CDS.  still generate the hash table at the init to reduce 
unnecessary static memory footage.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27628#discussion_r2464814725
PR Review Comment: https://git.openjdk.org/jdk/pull/27628#discussion_r2464804057
PR Review Comment: https://git.openjdk.org/jdk/pull/27628#discussion_r2464806436
PR Review Comment: https://git.openjdk.org/jdk/pull/27628#discussion_r2464807206
PR Review Comment: https://git.openjdk.org/jdk/pull/27628#discussion_r2464811378

Reply via email to