< prev index next >

src/java.base/share/classes/sun/misc/URLClassPath.java

Print this page

        

@@ -95,20 +95,20 @@
             new sun.security.action.GetPropertyAction("sun.misc.URLClassPath.disableJarChecking"));
         DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
     }
 
     /* The original search path of URLs. */
-    private ArrayList<URL> path = new ArrayList<URL>();
+    private ArrayList<URL> path = new ArrayList<>();
 
     /* The stack of unopened URLs */
-    Stack<URL> urls = new Stack<URL>();
+    Stack<URL> urls = new Stack<>();
 
     /* The resulting search path of Loaders */
-    ArrayList<Loader> loaders = new ArrayList<Loader>();
+    ArrayList<Loader> loaders = new ArrayList<>();
 
     /* Map of each URL opened to its corresponding Loader */
-    HashMap<String, Loader> lmap = new HashMap<String, Loader>();
+    HashMap<String, Loader> lmap = new HashMap<>();
 
     /* The jar protocol handler to use when creating new URLs */
     private URLStreamHandler jarHandler;
 
     /* Whether this URLClassLoader has been closed yet */

@@ -140,11 +140,11 @@
 
     public synchronized List<IOException> closeLoaders() {
         if (closed) {
             return Collections.emptyList();
         }
-        List<IOException> result = new LinkedList<IOException>();
+        List<IOException> result = new LinkedList<>();
         for (Loader loader : loaders) {
             try {
                 loader.close();
             } catch (IOException e) {
                 result.add (e);

@@ -232,11 +232,11 @@
      * @param name the resource name
      * @return an Enumeration of all the urls having the specified name
      */
     public Enumeration<URL> findResources(final String name,
                                      final boolean check) {
-        return new Enumeration<URL>() {
+        return new Enumeration<>() {
             private int index = 0;
             private URL url = null;
 
             private boolean next() {
                 if (url != null) {

@@ -279,11 +279,11 @@
      * @param name the resource name
      * @return an Enumeration of all the resources having the specified name
      */
     public Enumeration<Resource> getResources(final String name,
                                     final boolean check) {
-        return new Enumeration<Resource>() {
+        return new Enumeration<>() {
             private int index = 0;
             private Resource res = null;
 
             private boolean next() {
                 if (res != null) {

@@ -372,11 +372,11 @@
      * Returns the Loader for the specified base URL.
      */
     private Loader getLoader(final URL url) throws IOException {
         try {
             return java.security.AccessController.doPrivileged(
-                new java.security.PrivilegedExceptionAction<Loader>() {
+                new java.security.PrivilegedExceptionAction<>() {
                 public Loader run() throws IOException {
                     String file = url.getFile();
                     if (file != null && file.endsWith("/")) {
                         if ("file".equals(url.getProtocol())) {
                             return new FileLoader(url);

@@ -687,11 +687,11 @@
 
         private void ensureOpen() throws IOException {
             if (jar == null) {
                 try {
                     java.security.AccessController.doPrivileged(
-                        new java.security.PrivilegedExceptionAction<Void>() {
+                        new java.security.PrivilegedExceptionAction<>() {
                             public Void run() throws IOException {
                                 if (DEBUG) {
                                     System.err.println("Opening " + csu);
                                     Thread.dumpStack();
                                 }

@@ -868,11 +868,11 @@
                 return checkResource(name, check, entry);
 
             if (index == null)
                 return null;
 
-            HashSet<String> visited = new HashSet<String>();
+            HashSet<String> visited = new HashSet<>();
             return getResource(name, check, visited);
         }
 
         /*
          * Version of getResource() that tracks the jar files that have been

@@ -910,11 +910,11 @@
                         if ((newLoader = (JarLoader)lmap.get(urlNoFragString)) == null) {
                             /* no loader has been set up for this jar file
                              * before
                              */
                             newLoader = AccessController.doPrivileged(
-                                new PrivilegedExceptionAction<JarLoader>() {
+                                new PrivilegedExceptionAction<>() {
                                     public JarLoader run() throws IOException {
                                         return new JarLoader(url, handler,
                                             lmap);
                                     }
                                 });
< prev index next >