8205623: Replace use of Class::getPackage with Class::getPackageName

Reviewed-by: jjg, erikj
This commit is contained in:
Mandy Chung 2018-06-25 22:28:04 -07:00
parent 140e7415ff
commit 4e844fe623
3 changed files with 9 additions and 3 deletions

View File

@ -675,8 +675,14 @@ public class ReflectionFactory {
* @returns true if the two classes are in the same classloader and package
*/
private static boolean packageEquals(Class<?> cl1, Class<?> cl2) {
assert !cl1.isArray() && !cl2.isArray();
if (cl1 == cl2) {
return true;
}
return cl1.getClassLoader() == cl2.getClassLoader() &&
Objects.equals(cl1.getPackage(), cl2.getPackage());
Objects.equals(cl1.getPackageName(), cl2.getPackageName());
}
}

View File

@ -69,7 +69,7 @@ public abstract class BreakIteratorResourceBundle extends ResourceBundle {
if (!info.containsKey(key)) {
return null;
}
String path = getClass().getPackage().getName().replace('.', '/')
String path = getClass().getPackageName().replace('.', '/')
+ '/' + info.getString(key);
byte[] data;
try (InputStream is = getResourceAsStream(path)) {

View File

@ -53,7 +53,7 @@ final class CatalogMessages {
public static final String ERR_CREATING_URI = "FailedCreatingURI";
public static final String ERR_OTHER = "OtherError";
static final String bundleName = CatalogMessages.class.getPackage().getName() + ".CatalogMessages";
static final String bundleName = CatalogMessages.class.getPackageName() + ".CatalogMessages";
static ResourceBundle resourceBundle;
/**