Skip to content
Permalink
Browse files
8274635: Use String.equals instead of String.compareTo in jdk.accessi…
…bility

Reviewed-by: serb
  • Loading branch information
turbanoff authored and mrserb committed Oct 5, 2021
1 parent e43f540 commit 53d7e95bc637c8b629efc4587b2ae7961d719b00
@@ -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 void propertyChange(PropertyChangeEvent e) {

// 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();

@@ -5240,7 +5240,7 @@ public void propertyChange(PropertyChangeEvent e) {
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 @@ public void propertyChange(PropertyChangeEvent e) {
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 @@ public void propertyChange(PropertyChangeEvent e) {
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 @@ public void propertyChange(PropertyChangeEvent e) {
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 @@ public void propertyChange(PropertyChangeEvent e) {
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 @@ public void propertyChange(PropertyChangeEvent e) {
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 @@ public void propertyChange(PropertyChangeEvent e) {
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);
}
}

1 comment on commit 53d7e95

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 53d7e95 Oct 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.