mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Valery Kharseko
8 hours ago 48034eb9a1ebf0c3ee639ad0a6eb7dbd7aebd32d
Fix wrong-equals-signature and inconsistent-equals-and-hashcode CodeQL alerts in AttributeDescription (#783)
1 files modified
21 ■■■■ changed files
opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java 21 ●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
@@ -13,6 +13,7 @@
 *
 * Copyright 2009-2010 Sun Microsystems, Inc.
 * Portions copyright 2011-2016 ForgeRock AS.
 * Portions Copyright 2026 3A Systems, LLC.
 */
package org.forgerock.opendj.ldap;
@@ -62,7 +63,12 @@
        public abstract boolean hasOption(String normalizedOption);
        public abstract boolean equals(Impl other);
        /**
         * Options are compared by value, so this method must be kept consistent
         * with {@link #hashCode()}.
         */
        @Override
        public abstract boolean equals(Object other);
        public abstract String firstNormalizedOption();
@@ -130,7 +136,7 @@
        }
        @Override
        public boolean equals(final Impl other) {
        public boolean equals(final Object other) {
            if (other instanceof MultiOptionImpl) {
                final MultiOptionImpl tmp = (MultiOptionImpl) other;
                return Arrays.equals(normalizedOptions, tmp.normalizedOptions);
@@ -229,8 +235,13 @@
        }
        @Override
        public boolean equals(final Impl other) {
            return other.size() == 1 && other.hasOption(normalizedOption);
        public boolean equals(final Object other) {
            if (other instanceof Impl) {
                final Impl tmp = (Impl) other;
                return tmp.size() == 1 && tmp.hasOption(normalizedOption);
            } else {
                return false;
            }
        }
        @Override
@@ -289,7 +300,7 @@
        }
        @Override
        public boolean equals(final Impl other) {
        public boolean equals(final Object other) {
            return this == other;
        }