mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8190733: Use Class::getPackageName in java.base implementation
Reviewed-by: mchung, rriggs
This commit is contained in:
parent
73f177ea06
commit
5d7c797278
5 changed files with 10 additions and 36 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue