mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8301492: Modernize equals() method of ResourceBundle.CacheKey and Bundles.CacheKey
Reviewed-by: prappo, naoto
This commit is contained in:
parent
a08352f621
commit
297c799631
2 changed files with 3 additions and 7 deletions
|
@ -719,8 +719,7 @@ public abstract class ResourceBundle {
|
|||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
final CacheKey otherEntry = (CacheKey)other;
|
||||
if (other instanceof CacheKey otherEntry) {
|
||||
//quick check to see if they are not equal
|
||||
if (modulesHash != otherEntry.modulesHash) {
|
||||
return false;
|
||||
|
@ -738,7 +737,6 @@ public abstract class ResourceBundle {
|
|||
Module caller = getCallerModule();
|
||||
return ((module != null) && (module.equals(otherEntry.getModule())) &&
|
||||
(caller != null) && (caller.equals(otherEntry.getCallerModule())));
|
||||
} catch (NullPointerException | ClassCastException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2023, 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
|
||||
|
@ -502,15 +502,13 @@ public abstract class Bundles {
|
|||
if (this == other) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
final CacheKey otherEntry = (CacheKey)other;
|
||||
if (other instanceof CacheKey otherEntry) {
|
||||
//quick check to see if they are not equal
|
||||
if (hashCodeCache != otherEntry.hashCodeCache) {
|
||||
return false;
|
||||
}
|
||||
return locale.equals(otherEntry.locale)
|
||||
&& name.equals(otherEntry.name);
|
||||
} catch (NullPointerException | ClassCastException e) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue