Bug 575698 - Simplify creation of Enumerations

Change-Id: Iee43928d4fa726008267411ab8ff733bf4e0bad6
Signed-off-by: Hannes Wellmann <wellmann.hannes1@gmx.net>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.framework/+/184747
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
Reviewed-by: Thomas Watson <tjwatson@us.ibm.com>
diff --git a/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
index e51c25b..e236d4a 100644
--- a/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.equinox.launcher;singleton:=true
-Bundle-Version: 1.6.300.qualifier
+Bundle-Version: 1.6.400.qualifier
 Main-Class: org.eclipse.equinox.launcher.Main
 Bundle-ClassPath: .
 Bundle-Vendor: %providerName
diff --git a/bundles/org.eclipse.equinox.launcher/pom.xml b/bundles/org.eclipse.equinox.launcher/pom.xml
index 5db5cc7..cce13f2 100644
--- a/bundles/org.eclipse.equinox.launcher/pom.xml
+++ b/bundles/org.eclipse.equinox.launcher/pom.xml
@@ -19,6 +19,6 @@
   </parent>
   <groupId>org.eclipse.equinox</groupId>
   <artifactId>org.eclipse.equinox.launcher</artifactId>
-  <version>1.6.300-SNAPSHOT</version>
+  <version>1.6.400-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
index d37984a..6c215be 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
@@ -2629,23 +2629,7 @@
 
 				@Override
 				public Enumeration<Permission> elements() {
-					return new Enumeration<Permission>() {
-						int cur = 0;
-
-						@Override
-						public boolean hasMoreElements() {
-							return cur < 1;
-						}
-
-						@Override
-						public Permission nextElement() {
-							if (cur == 0) {
-								cur = 1;
-								return allPermission;
-							}
-							throw new NoSuchElementException();
-						}
-					};
+					return Collections.enumeration(Collections.singleton(allPermission));
 				}
 			};
 		}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java
index 9b16f16..e4be48b 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/connect/DelegatingConnectClassLoader.java
@@ -56,12 +56,12 @@
 	@Override
 	public Enumeration<URL> findLocalResources(String resource) {
 		if (connectClassLoader == null) {
-			return Collections.enumeration(Collections.emptyList());
+			return Collections.emptyEnumeration();
 		}
 		try {
 			return connectClassLoader.getResources(resource);
 		} catch (IOException e) {
-			return Collections.enumeration(Collections.emptyList());
+			return Collections.emptyEnumeration();
 		}
 	}
 }
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/InternalUtils.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/InternalUtils.java
index 9f3c7be..08ac1c3 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/InternalUtils.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/container/InternalUtils.java
@@ -18,6 +18,7 @@
 import java.util.AbstractList;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Random;
@@ -196,4 +197,17 @@
 		return new UUID(mostSignificantBits, leastSignificantBits).toString();
 	}
 
+	public static <E> Enumeration<E> asEnumeration(Iterator<E> it) {
+		return new Enumeration<E>() {
+			@Override
+			public boolean hasMoreElements() {
+				return it.hasNext();
+			}
+
+			@Override
+			public E nextElement() {
+				return it.next();
+			}
+		};
+	}
 }
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
index 1cf9909..29b05e3 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java
@@ -169,8 +169,8 @@
 	@Override
 	public Enumeration<URL> getResources(String arg0) throws IOException {
 		//Shortcut cycle
-		if (startLoading(arg0) == false) {
-			return Collections.enumeration(Collections.emptyList());
+		if (!startLoading(arg0)) {
+			return Collections.emptyEnumeration();
 		}
 		try {
 			List<ClassLoader> toConsult = findClassLoaders();
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
index b90ca0d..e966a82 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/BundleLoader.java
@@ -86,10 +86,6 @@
 
 	private static final Pattern PACKAGENAME_FILTER = Pattern.compile("\\(osgi.wiring.package\\s*=\\s*([^)]+)\\)"); //$NON-NLS-1$
 
-	// TODO needed instead of using Collections.emptyEnumertion until we no longer support Java 6
-	@SuppressWarnings("rawtypes")
-	private final static Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.emptyList());
-
 	private final ModuleWiring wiring;
 	private final EquinoxContainer container;
 	private final Debug debug;
@@ -685,7 +681,7 @@
 		if ((name.length() > 1) && (name.charAt(0) == '/')) /* if name has a leading slash */
 			name = name.substring(1); /* remove leading slash before search */
 		String pkgName = getResourcePackageName(name);
-		Enumeration<URL> result = emptyEnumeration();
+		Enumeration<URL> result = Collections.emptyEnumeration();
 		boolean bootDelegation = false;
 		// follow the OSGi delegation model
 		// First check the parent classloader for system resources, if it is a java resource.
@@ -839,12 +835,10 @@
 
 	public static <E> Enumeration<E> compoundEnumerations(Enumeration<E> list1, Enumeration<E> list2) {
 		if (list2 == null || !list2.hasMoreElements())
-			return list1 == null ? BundleLoader.emptyEnumeration() : list1;
+			return list1 == null ? Collections.emptyEnumeration() : list1;
 		if (list1 == null || !list1.hasMoreElements())
-			return list2 == null ? BundleLoader.emptyEnumeration() : list2;
-		List<E> compoundResults = new ArrayList<>();
-		while (list1.hasMoreElements())
-			compoundResults.add(list1.nextElement());
+			return list2 == null ? Collections.emptyEnumeration() : list2;
+		List<E> compoundResults = Collections.list(list1);
 		while (list2.hasMoreElements()) {
 			E item = list2.nextElement();
 			if (!compoundResults.contains(item)) //don't add duplicates
@@ -853,11 +847,6 @@
 		return Collections.enumeration(compoundResults);
 	}
 
-	@SuppressWarnings("unchecked")
-	private static <E> Enumeration<E> emptyEnumeration() {
-		return EMPTY_ENUMERATION;
-	}
-
 	/**
 	 * Finds a resource local to this bundle.  Only the classloader for this bundle is searched.
 	 * @param name The name of the resource to find.
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java
index c5c7f36..cf684bb 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/loader/classpath/ClasspathManager.java
@@ -63,8 +63,6 @@
 public class ClasspathManager {
 	private static final FragmentClasspath[] emptyFragments = new FragmentClasspath[0];
 	private static final String[] DEFAULT_CLASSPATH = new String[] {"."}; //$NON-NLS-1$
-	@SuppressWarnings("unchecked")
-	private static final Enumeration<URL> EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_LIST);
 
 	private final Generation generation;
 	private final ModuleClassLoader classloader;
@@ -445,7 +443,7 @@
 			ClasspathEntry[] hookEntries = hook.getClassPathEntries(resource, this);
 			if (hookEntries != null) {
 				findLocalResources(resource, hookEntries, m, classPathIndex, resources);
-				return resources.size() > 0 ? Collections.enumeration(resources) : EMPTY_ENUMERATION;
+				return resources.size() > 0 ? Collections.enumeration(resources) : Collections.emptyEnumeration();
 			}
 		}
 
@@ -459,7 +457,7 @@
 
 		if (resources.size() > 0)
 			return Collections.enumeration(resources);
-		return EMPTY_ENUMERATION;
+		return Collections.emptyEnumeration();
 	}
 
 	private void findLocalResources(String resource, ClasspathEntry[] cpEntries, Module m, int[] classPathIndex, List<URL> resources) {
@@ -874,15 +872,11 @@
 		for (FragmentClasspath fragmentClasspath : currentFragments)
 			generations.add(fragmentClasspath.getGeneration());
 
-		List<URL> result = Collections.emptyList();
 		// now search over all the bundle files
 		Enumeration<URL> eURLs = Storage.findEntries(generations, path, filePattern, options);
 		if (eURLs == null)
-			return result;
-		result = new ArrayList<>();
-		while (eURLs.hasMoreElements())
-			result.add(eURLs.nextElement());
-		return Collections.unmodifiableList(result);
+			return Collections.emptyList();
+		return Collections.unmodifiableList(Collections.list(eURLs));
 	}
 
 	/**
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java
index 6f8efeb..b8aa9d2 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java
@@ -57,9 +57,6 @@
 		}
 	}
 
-	@SuppressWarnings("unchecked")
-	private static final Enumeration<LogEntry> EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_LIST);
-
 	static final LogFilter NULL_LOGGER_FILTER = (b, loggerName, logLevel) -> true;
 
 	private static final LogFilter[] ALWAYS_LOG = new LogFilter[0];
@@ -311,7 +308,7 @@
 
 	Enumeration<LogEntry> getLog() {
 		if (history == null) {
-			return EMPTY_ENUMERATION;
+			return Collections.emptyEnumeration();
 		}
 		synchronized (history) {
 			return Collections.enumeration(new ArrayList<>(history));
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/BundlePermissions.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/BundlePermissions.java
index 2d874bd..fd7d2a7 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/BundlePermissions.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/BundlePermissions.java
@@ -13,28 +13,17 @@
  *******************************************************************************/
 package org.eclipse.osgi.internal.permadmin;
 
-import java.security.*;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.util.Collections;
 import java.util.Enumeration;
-import java.util.NoSuchElementException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.PackagePermission;
 
 public final class BundlePermissions extends PermissionCollection {
 	private static final long serialVersionUID = -5443618108312606612L;
 
-	// Note that this forces the Enumeration inner class to be loaded as soon as possible (see bug 119069)
-	static final Enumeration<Permission> EMPTY_ENUMERATION = new Enumeration<Permission>() {
-		@Override
-		public boolean hasMoreElements() {
-			return false;
-		}
-
-		@Override
-		public Permission nextElement() {
-			throw new NoSuchElementException();
-		}
-	};
-
 	private final Bundle bundle;
 	private final SecurityAdmin securityAdmin;
 	private final PermissionInfoCollection impliedPermissions;
@@ -75,8 +64,7 @@
 	public Enumeration<Permission> elements() {
 		// TODO return an empty enumeration for now;
 		// It does not seem possible to do this properly with multiple exports and conditional permissions.
-		// When looking to fix this be sure the Enumeration class is loaded as soon as possible (see bug 119069)
-		return EMPTY_ENUMERATION;
+		return Collections.emptyEnumeration();
 	}
 
 	@Override
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
index 34b895b..3c0d38d 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/PermissionInfoCollection.java
@@ -22,6 +22,7 @@
 import java.security.PermissionCollection;
 import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
@@ -70,7 +71,7 @@
 	@Override
 	public Enumeration<Permission> elements() {
 		// TODO return an empty enumeration for now;
-		return BundlePermissions.EMPTY_ENUMERATION;
+		return Collections.emptyEnumeration();
 	}
 
 	@Override
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTable.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTable.java
index 7fc0837..55abf9a 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTable.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/SecurityTable.java
@@ -16,6 +16,7 @@
 
 import java.security.Permission;
 import java.security.PermissionCollection;
+import java.util.Collections;
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -199,7 +200,7 @@
 
 	@Override
 	public Enumeration<Permission> elements() {
-		return BundlePermissions.EMPTY_ENUMERATION;
+		return Collections.emptyEnumeration();
 	}
 
 	@Override
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java
index ce0025b..0d48cb8 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/ManifestLocalization.java
@@ -254,10 +254,9 @@
 			this.localeString = locale;
 		}
 
-		@SuppressWarnings("unchecked")
 		@Override
 		public Enumeration<String> getKeys() {
-			return Collections.enumeration(Collections.EMPTY_LIST);
+			return Collections.emptyEnumeration();
 		}
 
 		@Override
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
index 2f6d939..7af943e 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
@@ -47,11 +47,12 @@
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.NoSuchElementException;
+import java.util.Objects;
 import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Stream;
 import org.eclipse.core.runtime.adaptor.EclipseStarter;
 import org.eclipse.osgi.container.Module;
 import org.eclipse.osgi.container.ModuleCapability;
@@ -68,6 +69,7 @@
 import org.eclipse.osgi.framework.util.FilePath;
 import org.eclipse.osgi.framework.util.ObjectPool;
 import org.eclipse.osgi.framework.util.SecureAction;
+import org.eclipse.osgi.internal.container.InternalUtils;
 import org.eclipse.osgi.internal.debug.Debug;
 import org.eclipse.osgi.internal.framework.EquinoxConfiguration;
 import org.eclipse.osgi.internal.framework.EquinoxContainer;
@@ -1993,50 +1995,10 @@
 		// return null if no entries found
 		if (pathList.size() == 0)
 			return null;
-		// create an enumeration to enumerate the pathList
-		final String[] pathArray = pathList.toArray(new String[pathList.size()]);
-		final Generation[] generationArray = generations.toArray(new Generation[generations.size()]);
-		return new Enumeration<URL>() {
-			private int curPathIndex = 0;
-			private int curDataIndex = 0;
-			private URL nextElement = null;
-
-			@Override
-			public boolean hasMoreElements() {
-				if (nextElement != null)
-					return true;
-				getNextElement();
-				return nextElement != null;
-			}
-
-			@Override
-			public URL nextElement() {
-				if (!hasMoreElements())
-					throw new NoSuchElementException();
-				URL result = nextElement;
-				// force the next element search
-				getNextElement();
-				return result;
-			}
-
-			private void getNextElement() {
-				nextElement = null;
-				if (curPathIndex >= pathArray.length)
-					// reached the end of the pathArray; no more elements
-					return;
-				while (nextElement == null && curPathIndex < pathArray.length) {
-					String curPath = pathArray[curPathIndex];
-					// search the generation until we have searched them all
-					while (nextElement == null && curDataIndex < generationArray.length)
-						nextElement = generationArray[curDataIndex++].getEntry(curPath);
-					// we have searched all datas then advance to the next path
-					if (curDataIndex >= generationArray.length) {
-						curPathIndex++;
-						curDataIndex = 0;
-					}
-				}
-			}
-		};
+		// create an enumeration to enumerate the pathList (generations must not change)
+		Stream<URL> entries = pathList.stream().flatMap(p -> generations.stream().map(g -> g.getEntry(p)))
+				.filter(Objects::nonNull);
+		return InternalUtils.asEnumeration(entries.iterator());
 	}
 
 	/**
@@ -2136,11 +2098,8 @@
 	private static LinkedHashSet<String> listEntryPaths(BundleFile bundleFile, String path, Filter patternFilter, Hashtable<String, String> patternProps, int options, LinkedHashSet<String> pathList) {
 		if (pathList == null)
 			pathList = new LinkedHashSet<>();
-		Enumeration<String> entryPaths;
-		if ((options & BundleWiring.FINDENTRIES_RECURSE) != 0)
-			entryPaths = bundleFile.getEntryPaths(path, true);
-		else
-			entryPaths = bundleFile.getEntryPaths(path);
+		boolean recurse = (options & BundleWiring.FINDENTRIES_RECURSE) != 0;
+		Enumeration<String> entryPaths = bundleFile.getEntryPaths(path, recurse);
 		if (entryPaths == null)
 			return pathList;
 		while (entryPaths.hasMoreElements()) {
diff --git a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF
index b4a9f5f..547a773 100644
--- a/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.osgi/supplement/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.equinox.supplement
-Bundle-Version: 1.10.200.qualifier
+Bundle-Version: 1.10.300.qualifier
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
 Export-Package: org.eclipse.equinox.log;version="1.1",
diff --git a/bundles/org.eclipse.osgi/supplement/pom.xml b/bundles/org.eclipse.osgi/supplement/pom.xml
index d1345a7..d430ff8 100644
--- a/bundles/org.eclipse.osgi/supplement/pom.xml
+++ b/bundles/org.eclipse.osgi/supplement/pom.xml
@@ -21,7 +21,7 @@
 
   <groupId>org.eclipse.equinox</groupId>
   <artifactId>org.eclipse.equinox.supplement</artifactId>
-  <version>1.10.200-SNAPSHOT</version>
+  <version>1.10.300-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 
 </project>
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/equinox/log/LogPermissionCollection.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/equinox/log/LogPermissionCollection.java
index f9e2fb0..da037a0 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/equinox/log/LogPermissionCollection.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/equinox/log/LogPermissionCollection.java
@@ -12,8 +12,8 @@
 
 import java.security.Permission;
 import java.security.PermissionCollection;
+import java.util.Collections;
 import java.util.Enumeration;
-import java.util.NoSuchElementException;
 
 /**
  * Stores a set of <code>LogPermission</code> permissions.
@@ -40,23 +40,7 @@
 
 	@Override
 	public Enumeration<Permission> elements() {
-		return new Enumeration<Permission>() {
-			private boolean hasMore = (logPermission != null);
-
-		@Override
-			public boolean hasMoreElements() {
-				return hasMore;
-			}
-
-		@Override
-			public Permission nextElement() {
-				if (hasMore) {
-					hasMore = false;
-					return logPermission;
-				}
-				throw new NoSuchElementException();
-			}
-		};
+		return logPermission != null ? Collections.enumeration(Collections.singleton(logPermission)) : Collections.emptyEnumeration();
 	}
 
 	@Override