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
|
@ -675,12 +675,11 @@ public abstract class ClassLoader {
|
|||
return;
|
||||
}
|
||||
|
||||
final String name = cls.getName();
|
||||
final int i = name.lastIndexOf('.');
|
||||
if (i != -1) {
|
||||
final String packageName = cls.getPackageName();
|
||||
if (!packageName.isEmpty()) {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
public Void run() {
|
||||
sm.checkPackageAccess(name.substring(0, i));
|
||||
sm.checkPackageAccess(packageName);
|
||||
return null;
|
||||
}
|
||||
}, new AccessControlContext(new ProtectionDomain[] {pd}));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue