src/share/classes/java/util/ResourceBundle.java

Print this page
rev 4788 : Fix bunch of generics warnings

*** 292,302 **** = new ConcurrentHashMap<>(INITIAL_CACHE_SIZE); /** * Queue for reference objects referring to class loaders or bundles. */ ! private static final ReferenceQueue referenceQueue = new ReferenceQueue(); /** * The parent bundle of this bundle. * The parent bundle is searched by {@link #getObject getObject} * when this bundle does not contain a particular resource. --- 292,303 ---- = new ConcurrentHashMap<>(INITIAL_CACHE_SIZE); /** * Queue for reference objects referring to class loaders or bundles. */ ! private static final ReferenceQueue<Object> referenceQueue = ! new ReferenceQueue<>(); /** * The parent bundle of this bundle. * The parent bundle is searched by {@link #getObject getObject} * when this bundle does not contain a particular resource.
*** 414,426 **** * Automatic determination of the ClassLoader to be used to load * resources on behalf of the client. N.B. The client is getLoader's * caller's caller. */ private static ClassLoader getLoader() { ! Class[] stack = getClassContext(); /* Magic number 2 identifies our caller's caller */ ! Class c = stack[2]; ClassLoader cl = (c == null) ? null : c.getClassLoader(); if (cl == null) { // When the caller's loader is the boot class loader, cl is null // here. In that case, ClassLoader.getSystemClassLoader() may // return the same class loader that the application is --- 415,427 ---- * Automatic determination of the ClassLoader to be used to load * resources on behalf of the client. N.B. The client is getLoader's * caller's caller. */ private static ClassLoader getLoader() { ! Class<?>[] stack = getClassContext(); /* Magic number 2 identifies our caller's caller */ ! Class<?> c = stack[2]; ClassLoader cl = (c == null) ? null : c.getClassLoader(); if (cl == null) { // When the caller's loader is the boot class loader, cl is null // here. In that case, ClassLoader.getSystemClassLoader() may // return the same class loader that the application is
*** 431,441 **** cl = RBClassLoader.INSTANCE; } return cl; } ! private static native Class[] getClassContext(); /** * A wrapper of ClassLoader.getSystemClassLoader(). */ private static class RBClassLoader extends ClassLoader { --- 432,442 ---- cl = RBClassLoader.INSTANCE; } return cl; } ! private static native Class<?>[] getClassContext(); /** * A wrapper of ClassLoader.getSystemClassLoader(). */ private static class RBClassLoader extends ClassLoader {
*** 671,681 **** */ private static final class LoaderReference extends WeakReference<ClassLoader> implements CacheKeyReference { private CacheKey cacheKey; ! LoaderReference(ClassLoader referent, ReferenceQueue q, CacheKey key) { super(referent, q); cacheKey = key; } public CacheKey getCacheKey() { --- 672,682 ---- */ private static final class LoaderReference extends WeakReference<ClassLoader> implements CacheKeyReference { private CacheKey cacheKey; ! LoaderReference(ClassLoader referent, ReferenceQueue<Object> q, CacheKey key) { super(referent, q); cacheKey = key; } public CacheKey getCacheKey() {
*** 689,699 **** */ private static final class BundleReference extends SoftReference<ResourceBundle> implements CacheKeyReference { private CacheKey cacheKey; ! BundleReference(ResourceBundle referent, ReferenceQueue q, CacheKey key) { super(referent, q); cacheKey = key; } public CacheKey getCacheKey() { --- 690,700 ---- */ private static final class BundleReference extends SoftReference<ResourceBundle> implements CacheKeyReference { private CacheKey cacheKey; ! BundleReference(ResourceBundle referent, ReferenceQueue<Object> q, CacheKey key) { super(referent, q); cacheKey = key; } public CacheKey getCacheKey() {
*** 1329,1339 **** /** * Checks if the given <code>List</code> is not null, not empty, * not having null in its elements. */ ! private static final boolean checkList(List a) { boolean valid = (a != null && a.size() != 0); if (valid) { int size = a.size(); for (int i = 0; valid && i < size; i++) { valid = (a.get(i) != null); --- 1330,1340 ---- /** * Checks if the given <code>List</code> is not null, not empty, * not having null in its elements. */ ! private static final boolean checkList(List<?> a) { boolean valid = (a != null && a.size() != 0); if (valid) { int size = a.size(); for (int i = 0; valid && i < size; i++) { valid = (a.get(i) != null);
*** 2560,2576 **** throws IllegalAccessException, InstantiationException, IOException { String bundleName = toBundleName(baseName, locale); ResourceBundle bundle = null; if (format.equals("java.class")) { try { ! Class<? extends ResourceBundle> bundleClass ! = (Class<? extends ResourceBundle>)loader.loadClass(bundleName); // If the class isn't a ResourceBundle subclass, throw a // ClassCastException. if (ResourceBundle.class.isAssignableFrom(bundleClass)) { ! bundle = bundleClass.newInstance(); } else { throw new ClassCastException(bundleClass.getName() + " cannot be cast to ResourceBundle"); } } catch (ClassNotFoundException e) { --- 2561,2576 ---- throws IllegalAccessException, InstantiationException, IOException { String bundleName = toBundleName(baseName, locale); ResourceBundle bundle = null; if (format.equals("java.class")) { try { ! Class<?> bundleClass = loader.loadClass(bundleName); // If the class isn't a ResourceBundle subclass, throw a // ClassCastException. if (ResourceBundle.class.isAssignableFrom(bundleClass)) { ! bundle = (ResourceBundle)bundleClass.newInstance(); } else { throw new ClassCastException(bundleClass.getName() + " cannot be cast to ResourceBundle"); } } catch (ClassNotFoundException e) {