8357690: Add @Stable and final to java.lang.CharacterDataLatin1 and other CharacterData classes

Reviewed-by: naoto
This commit is contained in:
Shaojin Wen 2025-05-29 20:09:58 +00:00
parent d922e318bc
commit 727412d1b5
10 changed files with 39 additions and 24 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -1190,7 +1190,7 @@ OUTER: for (int i = 0; i < n; i += m) {
if (Csyntax)
result.append(" static ");
else
result.append(" static final ");
result.append(" @Stable static final ");
result.append(atype);
result.append(" ").append(name).append("[");
if (Csyntax)
@ -1347,7 +1347,7 @@ OUTER: for (int i = 0; i < n; i += m) {
}
static void genCaseMapTableDeclaration(StringBuffer result) {
result.append(" static final char[][][] charMap;\n");
result.append(" @Stable static final char[][][] charMap;\n");
}
static void genCaseMapTable(StringBuffer result, SpecialCaseMap[] specialCaseMaps){

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,9 @@
package java.lang;
abstract class CharacterData {
abstract sealed class CharacterData
permits CharacterData00, CharacterData01, CharacterData02, CharacterData03,
CharacterData0E, CharacterDataLatin1, CharacterDataPrivateUse, CharacterDataUndefined {
abstract int getProperties(int ch);
abstract int getType(int ch);
abstract boolean isDigit(int ch);

View File

@ -25,12 +25,14 @@
package java.lang;
import jdk.internal.vm.annotation.Stable;
/**
* The CharacterData00 class encapsulates the large tables once found in
* java.lang.Character
*/
class CharacterData00 extends CharacterData {
final class CharacterData00 extends CharacterData {
/* The character properties are currently encoded into 32 bits in the following manner:
1 bit mirrored property
4 bits directionality property

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,11 +25,13 @@
package java.lang;
/** The CharacterData class encapsulates the large tables once found in
import jdk.internal.vm.annotation.Stable;
/** The CharacterData01 class encapsulates the large tables once found in
* java.lang.Character.
*/
class CharacterData01 extends CharacterData {
final class CharacterData01 extends CharacterData {
/* The character properties are currently encoded into 32 bits in the following manner:
1 bit mirrored property
4 bits directionality property

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,12 @@
package java.lang;
/** The CharacterData class encapsulates the large tables found in
import jdk.internal.vm.annotation.Stable;
/** The CharacterData02 class encapsulates the large tables found in
Java.lang.Character. */
class CharacterData02 extends CharacterData {
final class CharacterData02 extends CharacterData {
/* The character properties are currently encoded into 32 bits in the following manner:
1 bit mirrored property
4 bits directionality property

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,12 @@
package java.lang;
/** The CharacterData class encapsulates the large tables found in
import jdk.internal.vm.annotation.Stable;
/** The CharacterData03 class encapsulates the large tables found in
Java.lang.Character. */
class CharacterData03 extends CharacterData {
final class CharacterData03 extends CharacterData {
/* The character properties are currently encoded into 32 bits in the following manner:
1 bit mirrored property
4 bits directionality property

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,12 @@
package java.lang;
/** The CharacterData class encapsulates the large tables found in
import jdk.internal.vm.annotation.Stable;
/** The CharacterData0E class encapsulates the large tables found in
Java.lang.Character. */
class CharacterData0E extends CharacterData {
final class CharacterData0E extends CharacterData {
/* The character properties are currently encoded into 32 bits in the following manner:
1 bit mirrored property
4 bits directionality property

View File

@ -26,11 +26,12 @@
package java.lang;
import jdk.internal.vm.annotation.IntrinsicCandidate;
import jdk.internal.vm.annotation.Stable;
/** The CharacterData class encapsulates the large tables found in
/** The CharacterDataLatin1 class encapsulates the large tables found in
Java.lang.Character. */
class CharacterDataLatin1 extends CharacterData {
final class CharacterDataLatin1 extends CharacterData {
/* The character properties are currently encoded into 32 bits in the following manner:
1 bit mirrored property
@ -230,6 +231,7 @@ class CharacterDataLatin1 extends CharacterData {
//
// Analysis has shown that generating the whole array allows the JIT to generate
// better code compared to a slimmed down array, such as one cutting off after 'z'
@Stable
private static final byte[] DIGITS = new byte[] {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@ -314,6 +316,7 @@ class CharacterDataLatin1 extends CharacterData {
return mapChar;
}
@Stable
static char[] sharpsMap = new char[] {'S', 'S'};
char[] toUpperCaseCharArray(int ch) {

View File

@ -25,10 +25,10 @@
package java.lang;
/** The CharacterData class encapsulates the large tables found in
/** The CharacterDataPrivateUse class encapsulates the large tables found in
Java.lang.Character. */
class CharacterDataPrivateUse extends CharacterData {
final class CharacterDataPrivateUse extends CharacterData {
int getProperties(int ch) {
return 0;

View File

@ -25,10 +25,10 @@
package java.lang;
/** The CharacterData class encapsulates the large tables found in
/** The CharacterDataUndefined class encapsulates the large tables found in
Java.lang.Character. */
class CharacterDataUndefined extends CharacterData {
final class CharacterDataUndefined extends CharacterData {
int getProperties(int ch) {
return 0;