add equals/hashCode to KeyValuePair

Signed-off-by: Ceki Gulcu <ceki@qos.ch>
This commit is contained in:
Ceki Gulcu 2023-08-08 18:20:12 +02:00
parent 0769bc8182
commit 7a4da876b3
2 changed files with 17 additions and 4 deletions

View File

@ -142,8 +142,6 @@ public final class LoggerFactory {
* It is LoggerFactory's responsibility to track version changes and manage
* the compatibility list.
* <p>
* <p>
* It is assumed that all versions in the 1.6 are mutually compatible.
*/
static private final String[] API_COMPATIBILITY_LIST = new String[] { "2.0" };
@ -337,7 +335,7 @@ public final class LoggerFactory {
}
}
if (!match) {
Util.report("The requested version " + requested + " by your slf4j binding is not compatible with "
Util.report("The requested version " + requested + " by your slf4j provider is not compatible with "
+ Arrays.asList(API_COMPATIBILITY_LIST).toString());
Util.report("See " + VERSION_MISMATCH + " for further details.");
}
@ -348,7 +346,7 @@ public final class LoggerFactory {
// emit compatibility warnings.
} catch (Throwable e) {
// we should never reach here
Util.report("Unexpected problem occured during version sanity check", e);
Util.report("Unexpected problem occurred during version sanity check", e);
}
}

View File

@ -1,5 +1,7 @@
package org.slf4j.event;
import java.util.Objects;
public class KeyValuePair {
public final String key;
@ -14,4 +16,17 @@ public class KeyValuePair {
public String toString() {
return String.valueOf(key) + "=\"" + String.valueOf(value) +"\"";
}
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
KeyValuePair that = (KeyValuePair) o;
return Objects.equals(key, that.key) && Objects.equals(value, that.value);
}
@Override
public int hashCode() {
return Objects.hash(key, value);
}
}