mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8278863: Add method ClassDesc::ofInternalName
Reviewed-by: jvernee
This commit is contained in:
parent
4020ed53dd
commit
0fa7d9e8cd
3 changed files with 61 additions and 0 deletions
|
@ -58,6 +58,23 @@ class ConstantUtils {
|
|||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the correctness of an internal class name.
|
||||
* In particular checks for the presence of invalid characters in the name.
|
||||
*
|
||||
* @param name the class name
|
||||
* @return the class name passed if valid
|
||||
* @throws IllegalArgumentException if the class name is invalid
|
||||
*/
|
||||
static String validateInternalClassName(String name) {
|
||||
for (int i=0; i<name.length(); i++) {
|
||||
char ch = name.charAt(i);
|
||||
if (ch == ';' || ch == '[' || ch == '.')
|
||||
throw new IllegalArgumentException("Invalid class name: " + name);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a member name
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue