8378057: CAccessibility roleKey and AWTAccessor.AccessibleBundleAccessor are Redundant

Reviewed-by: kizune, serb
This commit is contained in:
Jeremy Wood 2026-03-08 00:39:15 +00:00 committed by Alexander Zuev
parent 8ef39a22d8
commit 7e5acdc6fa
2 changed files with 7 additions and 19 deletions

View File

@ -116,7 +116,9 @@ final class CAccessibility implements PropertyChangeListener {
if (newValue instanceof Accessible) {
AccessibleContext nvAC = ((Accessible) newValue).getAccessibleContext();
AccessibleRole nvRole = nvAC.getAccessibleRole();
if (!ignoredRoles.contains(roleKey(nvRole))) {
String roleStr = nvRole == null ? null :
AWTAccessor.getAccessibleBundleAccessor().getKey(nvRole);
if (!ignoredRoles.contains(roleStr)) {
focusChanged();
}
}
@ -1034,8 +1036,10 @@ final class CAccessibility implements PropertyChangeListener {
// "ignored", and we should skip it and its descendants
if (isShowing(context)) {
final AccessibleRole role = context.getAccessibleRole();
if (role != null && ignoredRoles != null &&
ignoredRoles.contains(roleKey(role))) {
String roleStr = role == null ? null :
AWTAccessor.getAccessibleBundleAccessor().getKey(role);
if (roleStr != null && ignoredRoles != null &&
ignoredRoles.contains(roleStr)) {
// Get the child's unignored children.
_addChildren(child, whichChildren, false,
childrenAndRoles, ChildrenOperations.COMMON);
@ -1096,8 +1100,6 @@ final class CAccessibility implements PropertyChangeListener {
return isShowing(parentContext);
}
private static native String roleKey(AccessibleRole aRole);
public static Object[] getChildren(final Accessible a, final Component c) {
if (a == null) return null;
return invokeAndWait(new Callable<Object[]>() {

View File

@ -325,20 +325,6 @@ static BOOL JavaAccessibilityIsSupportedAttribute(id element, NSString *attribut
return [[element accessibilityAttributeNames] indexOfObject:attribute] != NSNotFound;
}
/*
* Class: sun_lwawt_macosx_CAccessibility
* Method: roleKey
* Signature: (Ljavax/accessibility/AccessibleRole;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_sun_lwawt_macosx_CAccessibility_roleKey
(JNIEnv *env, jclass clz, jobject axRole)
{
DECLARE_CLASS_RETURN(sjc_AccessibleRole, "javax/accessibility/AccessibleRole", NULL);
DECLARE_FIELD_RETURN(sjf_key, sjc_AccessibleRole, "key", "Ljava/lang/String;", NULL);
return (*env)->GetObjectField(env, axRole, sjf_key);
}
// errors from NSAccessibilityErrors
void JavaAccessibilityRaiseSetAttributeToIllegalTypeException(const char *functionName, id element, NSString *attribute, id value)
{