src/share/classes/java/lang/ClassLoader.java
Print this page
rev 3186 : 6880112: Project Coin: Port JDK core library code to use diamond operator
*** 245,255 ****
// Shared among all packages with unsigned classes
private static final Certificate[] nocerts = new Certificate[0];
// The classes loaded by this class loader. The only purpose of this table
// is to keep the classes from being GC'ed until the loader is GC'ed.
! private final Vector<Class<?>> classes = new Vector<Class<?>>();
// The "default" domain. Set as the default ProtectionDomain on newly
// created classes.
private final ProtectionDomain defaultDomain =
new ProtectionDomain(new CodeSource(null, (Certificate[]) null),
--- 245,255 ----
// Shared among all packages with unsigned classes
private static final Certificate[] nocerts = new Certificate[0];
// The classes loaded by this class loader. The only purpose of this table
// is to keep the classes from being GC'ed until the loader is GC'ed.
! private final Vector<Class<?>> classes = new Vector<>();
// The "default" domain. Set as the default ProtectionDomain on newly
// created classes.
private final ProtectionDomain defaultDomain =
new ProtectionDomain(new CodeSource(null, (Certificate[]) null),
*** 265,275 ****
// The packages defined in this class loader. Each package name is mapped
// to its corresponding Package object.
// @GuardedBy("itself")
private final HashMap<String, Package> packages =
! new HashMap<String, Package>();
private static Void checkCreateClassLoader() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkCreateClassLoader();
--- 265,275 ----
// The packages defined in this class loader. Each package name is mapped
// to its corresponding Package object.
// @GuardedBy("itself")
private final HashMap<String, Package> packages =
! new HashMap<>();
private static Void checkCreateClassLoader() {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkCreateClassLoader();
*** 278,297 ****
}
private ClassLoader(Void unused, ClassLoader parent) {
this.parent = parent;
if (ParallelLoaders.isRegistered(this.getClass())) {
! parallelLockMap = new ConcurrentHashMap<String, Object>();
! package2certs = new ConcurrentHashMap<String, Certificate[]>();
domains =
Collections.synchronizedSet(new HashSet<ProtectionDomain>());
assertionLock = new Object();
} else {
// no finer-grained lock; lock on the classloader instance
parallelLockMap = null;
! package2certs = new Hashtable<String, Certificate[]>();
! domains = new HashSet<ProtectionDomain>();
assertionLock = this;
}
}
/**
--- 278,297 ----
}
private ClassLoader(Void unused, ClassLoader parent) {
this.parent = parent;
if (ParallelLoaders.isRegistered(this.getClass())) {
! parallelLockMap = new ConcurrentHashMap<>();
! package2certs = new ConcurrentHashMap<>();
domains =
Collections.synchronizedSet(new HashSet<ProtectionDomain>());
assertionLock = new Object();
} else {
// no finer-grained lock; lock on the classloader instance
parallelLockMap = null;
! package2certs = new Hashtable<>();
! domains = new HashSet<>();
assertionLock = this;
}
}
/**
*** 1180,1190 ****
} else {
tmp[0] = getBootstrapResources(name);
}
tmp[1] = findResources(name);
! return new CompoundEnumeration<URL>(tmp);
}
/**
* Finds the resource with the given name. Class loader implementations
* should override this method to specify where to find resources. </p>
--- 1180,1190 ----
} else {
tmp[0] = getBootstrapResources(name);
}
tmp[1] = findResources(name);
! return new CompoundEnumeration<>(tmp);
}
/**
* Finds the resource with the given name. Class loader implementations
* should override this method to specify where to find resources. </p>
*** 1655,1665 ****
* @since 1.2
*/
protected Package[] getPackages() {
Map<String, Package> map;
synchronized (packages) {
! map = new HashMap<String, Package>(packages);
}
Package[] pkgs;
if (parent != null) {
pkgs = parent.getPackages();
} else {
--- 1655,1665 ----
* @since 1.2
*/
protected Package[] getPackages() {
Map<String, Package> map;
synchronized (packages) {
! map = new HashMap<>(packages);
}
Package[] pkgs;
if (parent != null) {
pkgs = parent.getPackages();
} else {
*** 1763,1785 ****
}
}
// All native library names we've loaded.
private static Vector<String> loadedLibraryNames
! = new Vector<String>();
// Native libraries belonging to system classes.
private static Vector<NativeLibrary> systemNativeLibraries
! = new Vector<NativeLibrary>();
// Native libraries associated with the class loader.
private Vector<NativeLibrary> nativeLibraries
! = new Vector<NativeLibrary>();
// native libraries being loaded/unloaded.
private static Stack<NativeLibrary> nativeLibraryContext
! = new Stack<NativeLibrary>();
// The paths searched for libraries
private static String usr_paths[];
private static String sys_paths[];
--- 1763,1785 ----
}
}
// All native library names we've loaded.
private static Vector<String> loadedLibraryNames
! = new Vector<>();
// Native libraries belonging to system classes.
private static Vector<NativeLibrary> systemNativeLibraries
! = new Vector<>();
// Native libraries associated with the class loader.
private Vector<NativeLibrary> nativeLibraries
! = new Vector<>();
// native libraries being loaded/unloaded.
private static Stack<NativeLibrary> nativeLibraryContext
! = new Stack<>();
// The paths searched for libraries
private static String usr_paths[];
private static String sys_paths[];
*** 2099,2110 ****
/*
* Whether or not "Java assertion maps" are initialized, set
* them to empty maps, effectively ignoring any present settings.
*/
synchronized (assertionLock) {
! classAssertionStatus = new HashMap<String, Boolean>();
! packageAssertionStatus = new HashMap<String, Boolean>();
defaultAssertionStatus = false;
}
}
/**
--- 2099,2110 ----
/*
* Whether or not "Java assertion maps" are initialized, set
* them to empty maps, effectively ignoring any present settings.
*/
synchronized (assertionLock) {
! classAssertionStatus = new HashMap<>();
! packageAssertionStatus = new HashMap<>();
defaultAssertionStatus = false;
}
}
/**
*** 2162,2173 ****
// Set up the assertions with information provided by the VM.
// Note: Should only be called inside a synchronized block
private void initializeJavaAssertionMaps() {
// assert Thread.holdsLock(assertionLock);
! classAssertionStatus = new HashMap<String, Boolean>();
! packageAssertionStatus = new HashMap<String, Boolean>();
AssertionStatusDirectives directives = retrieveDirectives();
for(int i = 0; i < directives.classes.length; i++)
classAssertionStatus.put(directives.classes[i],
directives.classEnabled[i]);
--- 2162,2173 ----
// Set up the assertions with information provided by the VM.
// Note: Should only be called inside a synchronized block
private void initializeJavaAssertionMaps() {
// assert Thread.holdsLock(assertionLock);
! classAssertionStatus = new HashMap<>();
! packageAssertionStatus = new HashMap<>();
AssertionStatusDirectives directives = retrieveDirectives();
for(int i = 0; i < directives.classes.length; i++)
classAssertionStatus.put(directives.classes[i],
directives.classEnabled[i]);