8274635: Use String.equals instead of String.compareTo in jdk.accessibility

Reviewed-by: serb
This commit is contained in:
Andrey Turbanov 2021-10-05 06:39:29 +00:00 committed by Sergey Bylokhov
parent e43f540cde
commit 53d7e95bc6
2 changed files with 12 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2021, 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,8 @@
package com.sun.java.accessibility.util;
import java.util.*;
import java.beans.*;
import java.awt.*;
import java.awt.event.*;
import javax.accessibility.*;
/**
@ -317,7 +315,7 @@ public class AccessibilityEventMonitor {
// handle childbirth/death
String name = e.getPropertyName();
if (name.compareTo(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY) == 0) {
if (name.equals(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY)) {
Object oldValue = e.getOldValue();
Object newValue = e.getNewValue();

View File

@ -5240,7 +5240,7 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: AccessibleContext: " + ac);
String propertyName = e.getPropertyName();
if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_CARET_PROPERTY) == 0) {
if (propertyName.equals(AccessibleContext.ACCESSIBLE_CARET_PROPERTY)) {
int oldValue = 0;
int newValue = 0;
@ -5253,7 +5253,7 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: - about to call propertyCaretChange() old value: " + oldValue + "new value: " + newValue);
accessBridge.propertyCaretChange(e, ac, oldValue, newValue);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_DESCRIPTION_PROPERTY)) {
String oldValue = null;
String newValue = null;
@ -5266,7 +5266,7 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: - about to call propertyDescriptionChange() old value: " + oldValue + "new value: " + newValue);
accessBridge.propertyDescriptionChange(e, ac, oldValue, newValue);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_NAME_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_NAME_PROPERTY)) {
String oldValue = null;
String newValue = null;
@ -5279,12 +5279,12 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: - about to call propertyNameChange() old value: " + oldValue + " new value: " + newValue);
accessBridge.propertyNameChange(e, ac, oldValue, newValue);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY)) {
accessBridge.debugString("[INFO]: - about to call propertySelectionChange() " + ac + " " + Thread.currentThread() + " " + e.getSource());
accessBridge.propertySelectionChange(e, ac);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_STATE_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_STATE_PROPERTY)) {
String oldValue = null;
String newValue = null;
@ -5301,11 +5301,11 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: - about to call propertyStateChange()");
accessBridge.propertyStateChange(e, ac, oldValue, newValue);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_TEXT_PROPERTY)) {
accessBridge.debugString("[INFO]: - about to call propertyTextChange()");
accessBridge.propertyTextChange(e, ac);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_VALUE_PROPERTY) == 0) { // strings 'cause of floating point, etc.
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_VALUE_PROPERTY)) { // strings 'cause of floating point, etc.
String oldValue = null;
String newValue = null;
@ -5318,10 +5318,10 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: - about to call propertyDescriptionChange()");
accessBridge.propertyValueChange(e, ac, oldValue, newValue);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_VISIBLE_DATA_PROPERTY)) {
accessBridge.propertyVisibleDataChange(e, ac);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_CHILD_PROPERTY)) {
AccessibleContext oldAC = null;
AccessibleContext newAC = null;
Accessible a;
@ -5337,7 +5337,7 @@ final public class AccessBridge {
accessBridge.debugString("[INFO]: - about to call propertyChildChange() old AC: " + oldAC + "new AC: " + newAC);
accessBridge.propertyChildChange(e, ac, oldAC, newAC);
} else if (propertyName.compareTo(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY) == 0) {
} else if (propertyName.equals(AccessibleContext.ACCESSIBLE_ACTIVE_DESCENDANT_PROPERTY)) {
handleActiveDescendentEvent(e, ac);
}
}