< prev index next >
src/java.base/share/classes/java/net/URLClassLoader.java
Print this page
@@ -357,11 +357,11 @@
throws ClassNotFoundException
{
final Class<?> result;
try {
result = AccessController.doPrivileged(
- new PrivilegedExceptionAction<Class<?>>() {
+ new PrivilegedExceptionAction<>() {
public Class<?> run() throws ClassNotFoundException {
String path = name.replace('.', '/').concat(".class");
Resource res = ucp.getResource(path, false);
if (res != null) {
try {
@@ -562,11 +562,11 @@
public URL findResource(final String name) {
/*
* The same restriction to finding classes applies to resources
*/
URL url = AccessController.doPrivileged(
- new PrivilegedAction<URL>() {
+ new PrivilegedAction<>() {
public URL run() {
return ucp.findResource(name, true);
}
}, acc);
@@ -585,20 +585,20 @@
public Enumeration<URL> findResources(final String name)
throws IOException
{
final Enumeration<URL> e = ucp.findResources(name, true);
- return new Enumeration<URL>() {
+ return new Enumeration<>() {
private URL url = null;
private boolean next() {
if (url != null) {
return true;
}
do {
URL u = AccessController.doPrivileged(
- new PrivilegedAction<URL>() {
+ new PrivilegedAction<>() {
public URL run() {
if (!e.hasMoreElements())
return null;
return e.nextElement();
}
@@ -702,11 +702,11 @@
if (p != null) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
final Permission fp = p;
- AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() throws SecurityException {
sm.checkPermission(fp);
return null;
}
}, acc);
@@ -733,11 +733,11 @@
final ClassLoader parent) {
// Save the caller's context
final AccessControlContext acc = AccessController.getContext();
// Need a privileged block to create the class loader
URLClassLoader ucl = AccessController.doPrivileged(
- new PrivilegedAction<URLClassLoader>() {
+ new PrivilegedAction<>() {
public URLClassLoader run() {
return new FactoryURLClassLoader(urls, parent, acc);
}
});
return ucl;
@@ -758,11 +758,11 @@
public static URLClassLoader newInstance(final URL[] urls) {
// Save the caller's context
final AccessControlContext acc = AccessController.getContext();
// Need a privileged block to create the class loader
URLClassLoader ucl = AccessController.doPrivileged(
- new PrivilegedAction<URLClassLoader>() {
+ new PrivilegedAction<>() {
public URLClassLoader run() {
return new FactoryURLClassLoader(urls, acc);
}
});
return ucl;
< prev index next >