8190733: Use Class::getPackageName in java.base implementation

Reviewed-by: mchung, rriggs
This commit is contained in:
Christoph Dreis 2017-11-08 13:38:00 -08:00 committed by Mandy Chung
parent 73f177ea06
commit 5d7c797278
5 changed files with 10 additions and 36 deletions

View file

@ -332,16 +332,6 @@ public class VerifyAccess {
return Objects.equals(class1.getPackageName(), class2.getPackageName());
}
/** Return the package name for this class.
*/
public static String getPackageName(Class<?> cls) {
assert (!cls.isArray());
String name = cls.getName();
int dot = name.lastIndexOf('.');
if (dot < 0) return "";
return name.substring(0, dot);
}
/**
* Test if two classes are defined as part of the same package member (top-level class).
* If this is true, they can share private access with each other.