Use singleton maps. (FELIX-2950)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1154015 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index a0683f4..2dcf8f8 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -2494,8 +2494,8 @@
{
// Try to see if there is an exporter available.
Map<String, String> dirs = Collections.EMPTY_MAP;
- Map<String, Object> attrs = new HashMap<String, Object>(1);
- attrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
+ Map<String, Object> attrs = Collections.singletonMap(
+ BundleRevision.PACKAGE_NAMESPACE, (Object) pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
revision, BundleRevision.PACKAGE_NAMESPACE, dirs, attrs);
Set<BundleCapability> exporters = resolver.getCandidates(req, false);
@@ -2533,8 +2533,8 @@
// Next, check to see if there are any exporters for the package at all.
Map<String, String> dirs = Collections.EMPTY_MAP;
- Map<String, Object> attrs = new HashMap<String, Object>(1);
- attrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
+ Map<String, Object> attrs = Collections.singletonMap(
+ BundleRevision.PACKAGE_NAMESPACE, (Object) pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
revision, BundleRevision.PACKAGE_NAMESPACE, dirs, attrs);
Set<BundleCapability> exports = resolver.getCandidates(req, false);
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index d430584..8935760 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3578,8 +3578,8 @@
ExportedPackage[] getExportedPackages(String pkgName)
{
// First, get all exporters of the package.
- Map<String, Object> attrs = new HashMap<String, Object>(1);
- attrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
+ Map<String, Object> attrs = Collections.singletonMap(
+ BundleRevision.PACKAGE_NAMESPACE, (Object) pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
null,
BundleRevision.PACKAGE_NAMESPACE,
diff --git a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
index 0e68de3..2d01f27 100644
--- a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
+++ b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
@@ -722,8 +722,8 @@
// Loop through the importer's dynamic requirements to determine if
// there is a matching one for the package from which we want to
// load a class.
- Map<String, Object> attrs = new HashMap(1);
- attrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
+ Map<String, Object> attrs = Collections.singletonMap(
+ BundleRevision.PACKAGE_NAMESPACE, (Object) pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
revision,
BundleRevision.PACKAGE_NAMESPACE,
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
index 15da660..46d6c27 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/ResolverImpl.java
@@ -554,8 +554,8 @@
}
// Determine if any providers of the package exist.
- Map<String, Object> attrs = new HashMap(1);
- attrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
+ Map<String, Object> attrs = Collections.singletonMap(
+ BundleRevision.PACKAGE_NAMESPACE, (Object) pkgName);
BundleRequirementImpl req = new BundleRequirementImpl(
revision,
BundleRevision.PACKAGE_NAMESPACE,