eliminate Eclipse IDE warnings

Signed-off-by: Raymond Augé <rotty3000@apache.org>
diff --git a/itests/pom.xml b/itests/pom.xml
index b1d9da3..66a8633 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -75,6 +75,9 @@
 						<configuration>
 							<bnd><![CDATA[
 								Fragment-Host: org.apache.aries.component-dsl.component-dsl
+
+								# This is only happens in m2e presumably because project dependencies are not jars but output directories
+								-fixupmessages: Host * for this fragment/require bundle cannot be found on the classpath
 							]]></bnd>
 							<testCases>junit4</testCases>
 						</configuration>
diff --git a/itests/src/test/java/org/apache/aries/component/dsl/test/AsynchronousTest.java b/itests/src/test/java/org/apache/aries/component/dsl/test/AsynchronousTest.java
index 8fc1b70..03dcf93 100644
--- a/itests/src/test/java/org/apache/aries/component/dsl/test/AsynchronousTest.java
+++ b/itests/src/test/java/org/apache/aries/component/dsl/test/AsynchronousTest.java
@@ -30,7 +30,6 @@
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 
-import java.util.Hashtable;
 import java.util.Random;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -96,9 +95,7 @@
                             bundleContext.registerService(
                                 Service.class,
                                 new Service(ii),
-                                new Hashtable<String, Object>() {{
-                                    put("property", "a");
-                                }});
+                                HashTable.of("property", "a"));
 
                         ignoreException(() -> Thread.sleep(random.nextInt(2)));
 
@@ -111,9 +108,7 @@
                             bundleContext.registerService(
                                 Service.class,
                                 new Service(jj),
-                                new Hashtable<String, Object>() {{
-                                    put("property", "b");
-                                }});
+                                HashTable.of("property", "b"));
 
                         ignoreException(() -> Thread.sleep(random.nextInt(2)));
 
@@ -126,9 +121,7 @@
                             bundleContext.registerService(
                                 Service.class,
                                 new Service(kk),
-                                new Hashtable<String, Object>() {{
-                                    put("property", "c");
-                                }});
+                                HashTable.of("property", "c"));
 
                         ignoreException(() -> Thread.sleep(random.nextInt(2)));
 
@@ -226,9 +219,7 @@
                             bundleContext.registerService(
                                 Service.class,
                                 new Service(ii),
-                                new Hashtable<String, Object>() {{
-                                    put("property", "a");
-                                }});
+                                HashTable.of("property", "a"));
 
                         ignoreException(() -> Thread.sleep(random.nextInt(2)));
 
@@ -241,9 +232,7 @@
                             bundleContext.registerService(
                                 Service.class,
                                 new Service(jj),
-                                new Hashtable<String, Object>() {{
-                                    put("property", "b");
-                                }});
+                                HashTable.of("property", "b"));
 
                         ignoreException(() -> Thread.sleep(random.nextInt(2)));
 
@@ -258,10 +247,7 @@
                                     "configurationc");
 
                             configurationc.update(
-                                new Hashtable<String, Object>() {{
-                                    put("property", kk);
-                                }}
-                            );
+                                HashTable.of("property", kk));
 
                             configurationc.delete();
                         }));
diff --git a/itests/src/test/java/org/apache/aries/component/dsl/test/CachingServiceReferenceTests.java b/itests/src/test/java/org/apache/aries/component/dsl/test/CachingServiceReferenceTests.java
index 4ff1c2b..d94c780 100644
--- a/itests/src/test/java/org/apache/aries/component/dsl/test/CachingServiceReferenceTests.java
+++ b/itests/src/test/java/org/apache/aries/component/dsl/test/CachingServiceReferenceTests.java
@@ -25,7 +25,6 @@
 import org.osgi.framework.ServiceRegistration;
 
 import java.util.Arrays;
-import java.util.Hashtable;
 import java.util.List;
 import java.util.TreeSet;
 
@@ -46,22 +45,17 @@
         ServiceRegistration<Service> serviceRegistrationNoRanking =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         ServiceRegistration<Service> serviceRegistrationOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("service.ranking", 1);
-                }});
+                HashTable.of("service.ranking", 1));
 
         ServiceRegistration<Service> serviceRegistrationMinusOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("service.ranking", -1);
-                }});
+                HashTable.of("service.ranking", -1));
 
         try {
             TreeSet<CachingServiceReference<?>> set = new TreeSet<>();
@@ -104,8 +98,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         try {
             ServiceReference<Service> serviceReference =
@@ -119,10 +112,7 @@
                 cachingServiceReference.getProperty("property"));
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertEquals(serviceReference.getProperty("property"), "value2");
 
@@ -140,8 +130,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         try {
             ServiceReference<Service> serviceReference =
@@ -162,10 +151,7 @@
             assertFalse(properties.contains("property"));
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertEquals(serviceReference.getProperty("property"), "value2");
 
@@ -183,9 +169,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }});
+                HashTable.of("property", "value"));
 
         try {
             ServiceReference<Service> serviceReference =
@@ -199,10 +183,7 @@
                 cachingServiceReference.getProperty("property"));
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertEquals(serviceReference.getProperty("property"), "value2");
 
@@ -219,9 +200,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }});
+                HashTable.of("property", "value"));
 
         try {
             ServiceReference<Service> serviceReference =
@@ -238,10 +217,7 @@
                 serviceReference.getProperty("property"),
                 cachingServiceReference.getProperty("property"));
 
-            serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                }}
-            );
+            serviceRegistration.setProperties(HashTable.of());
 
             assertNull(serviceReference.getProperty("property"));
 
@@ -265,9 +241,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }});
+                HashTable.of("property", "value"));
 
         try {
             ServiceReference<Service> serviceReference =
@@ -281,10 +255,7 @@
                 cachingServiceReference.getProperty("property"));
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertTrue(cachingServiceReference.isDirty());
         }
@@ -298,9 +269,8 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }});
+                HashTable.of("property", "value"));
+
         try {
             ServiceReference<Service> serviceReference =
                 serviceRegistration.getReference();
@@ -309,10 +279,7 @@
                 new CachingServiceReference<>(serviceReference);
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertFalse(cachingServiceReference.isDirty());
         }
@@ -326,9 +293,8 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }});
+                HashTable.of("property", "value"));
+
         try {
             ServiceReference<Service> serviceReference =
                 serviceRegistration.getReference();
@@ -337,10 +303,7 @@
                 new CachingServiceReference<>(serviceReference);
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertFalse(cachingServiceReference.isDirty("property"));
 
@@ -350,10 +313,7 @@
             assertFalse(cachingServiceReference.isDirty("property"));
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value3");
-                }}
-            );
+                HashTable.of("property", "value3"));
 
             assertTrue(cachingServiceReference.isDirty("property"));
         }
@@ -367,8 +327,8 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
+
         try {
             ServiceReference<Service> serviceReference =
                 serviceRegistration.getReference();
@@ -389,9 +349,8 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }});
+                HashTable.of("property", "value"));
+
         try {
             ServiceReference<Service> serviceReference =
                 serviceRegistration.getReference();
@@ -400,10 +359,7 @@
                 new CachingServiceReference<>(serviceReference);
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "value2");
-                }}
-            );
+                HashTable.of("property", "value2"));
 
             assertEquals(
                 serviceReference.getProperty("property"),
diff --git a/itests/src/test/java/org/apache/aries/component/dsl/test/ComponentTest.java b/itests/src/test/java/org/apache/aries/component/dsl/test/ComponentTest.java
index d2ae68e..9d365c7 100644
--- a/itests/src/test/java/org/apache/aries/component/dsl/test/ComponentTest.java
+++ b/itests/src/test/java/org/apache/aries/component/dsl/test/ComponentTest.java
@@ -100,9 +100,7 @@
 
         _bundleContext.registerService(
             ManagedService.class, dictionary -> countDownLatch.countDown(),
-            new Hashtable<String, Object>() {{
-                put("service.pid", "org.components.MyComponent");
-            }});
+            HashTable.of("service.pid", "org.components.MyComponent"));
 
         Configuration factoryConfiguration = null;
 
@@ -139,9 +137,7 @@
             ServiceRegistration<ServiceOptional> serviceRegistration3 =
                 _bundleContext.registerService(
                     ServiceOptional.class, serviceOptional,
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 1);
-                    }});
+                    HashTable.of("service.ranking", 1));
 
             assertEquals(serviceOptional, component.getOptional());
 
@@ -277,9 +273,7 @@
             ServiceRegistration<ServiceOptional> serviceRegistration3 =
                 _bundleContext.registerService(
                     ServiceOptional.class, serviceOptional,
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 1);
-                    }});
+                    HashTable.of("service.ranking", 1));
 
             assertEquals(serviceOptional, component.getOptional());
 
@@ -337,7 +331,7 @@
                     CachingServiceReference::getServiceReference).
                 flatMap(sr ->
             bundleContext().flatMap(bc ->
-            onClose(() -> bc.ungetService(sr)).then(
+            effects(() -> bc.ungetService(sr), () -> {}).then(
             just(bc.getService(sr))
             )));
     }
@@ -348,6 +342,7 @@
         return program.foreach(bind, unbind);
     }
 
+    @SuppressWarnings("unused")
     private class Component {
 
         final Dictionary<String, ?> configuration;
diff --git a/itests/src/test/java/org/apache/aries/component/dsl/test/DSLTest.java b/itests/src/test/java/org/apache/aries/component/dsl/test/DSLTest.java
index 540b62c..dcc4ae7 100644
--- a/itests/src/test/java/org/apache/aries/component/dsl/test/DSLTest.java
+++ b/itests/src/test/java/org/apache/aries/component/dsl/test/DSLTest.java
@@ -87,8 +87,7 @@
         ServiceRegistration<Service> serviceRegistrationOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         expected.add(
             Collections.singletonList(getId(serviceRegistrationOne)));
@@ -100,8 +99,7 @@
         serviceRegistrationOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         expected.add(
             Collections.singletonList(getId(serviceRegistrationOne)));
@@ -109,8 +107,7 @@
         ServiceRegistration<Service> serviceRegistrationTwo =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         expected.add(
             Arrays.asList(
@@ -154,8 +151,7 @@
         ServiceRegistration<Service> serviceRegistrationOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         expected.add(
             Collections.singletonList(getId(serviceRegistrationOne)));
@@ -165,8 +161,7 @@
         serviceRegistrationOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         expected.add(
             Collections.singletonList(getId(serviceRegistrationOne)));
@@ -174,8 +169,7 @@
         ServiceRegistration<Service> serviceRegistrationTwo =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                }});
+                HashTable.of());
 
         expected.add(
             Arrays.asList(
@@ -497,9 +491,7 @@
         ServiceRegistration<ManagedService> serviceRegistration =
             bundleContext.registerService(
                 ManagedService.class, __ -> countDownLatch.countDown(),
-                new Hashtable<String, Object>() {{
-                    put("service.pid", "test.configuration");
-                }});
+                HashTable.of("service.pid", "test.configuration"));
 
         AtomicReference<Runnable> effect = new AtomicReference<>();
 
@@ -531,10 +523,7 @@
                 .run(bundleContext)
         ) {
             configuration.update(
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }}
-            );
+                HashTable.of("property", "value"));
 
             countDownLatch.await(5, TimeUnit.MINUTES);
 
@@ -560,9 +549,7 @@
                             deleteLatch.countDown();
                         }
                     },
-                    new Hashtable<String, Object>() {{
-                        put("service.pid", "test.configuration");
-                    }});
+                    HashTable.of("service.pid", "test.configuration"));
 
             configuration.delete();
 
@@ -609,9 +596,7 @@
         ServiceRegistration<ManagedService> serviceRegistration =
             bundleContext.registerService(
                 ManagedService.class, __ -> countDownLatch.countDown(),
-                new Hashtable<String, Object>() {{
-                    put("service.pid", "test.configuration");
-                }});
+                HashTable.of("service.pid", "test.configuration"));
 
         AtomicReference<Runnable> effect = new AtomicReference<>();
 
@@ -634,10 +619,7 @@
                 }))
         {
             configuration.update(
-                new Hashtable<String, Object>() {{
-                    put("property", "value");
-                }}
-            );
+                HashTable.of("property", "value"));
 
             countDownLatch.await(5, TimeUnit.MINUTES);
 
@@ -661,9 +643,7 @@
                             deleteLatch.countDown();
                         }
                     },
-                    new Hashtable<String, Object>() {{
-                        put("service.pid", "test.configuration");
-                    }});
+                    HashTable.of("service.pid", "test.configuration"));
 
             configuration.delete();
 
@@ -754,9 +734,7 @@
         ServiceRegistration<ManagedService> serviceRegistration =
             bundleContext.registerService(
                 ManagedService.class, __ -> countDownLatch.countDown(),
-                new Hashtable<String, Object>() {{
-                    put("service.pid", "test.configuration");
-                }});
+                HashTable.of("service.pid", "test.configuration"));
 
         try(OSGiResult result =
                 configuration("test.configuration").run(
@@ -853,11 +831,10 @@
                 map(d -> d.get("key")).flatMap(key ->
             register(
                 Service.class, new Service(),
-                new HashMap<String, Object>() {{
-                    put("key", key);
-                    put("test.configuration", true);
-                }})
-            );
+                HashTable.of(h -> {
+                    h.put("key", key);
+                    h.put("test.configuration", true);
+                })));
 
         OSGiResult result = program.run(
             bundleContext);
@@ -901,23 +878,17 @@
         Configuration configuration =
             configurationAdmin.createFactoryConfiguration("test.configuration");
 
-        configuration.update(new Hashtable<String, Object>(){{
-            put("key", "service one");
-        }});
+        configuration.update(HashTable.of("key", "service one"));
 
         Configuration configuration2 =
             configurationAdmin.createFactoryConfiguration("test.configuration");
 
-        configuration2.update(new Hashtable<String, Object>(){{
-            put("key", "service two");
-        }});
+        configuration2.update(HashTable.of("key", "service two"));
 
         Configuration configuration3 =
             configurationAdmin.createFactoryConfiguration("test.configuration");
 
-        configuration3.update(new Hashtable<String, Object>(){{
-            put("key", "service three");
-        }});
+        configuration3.update(HashTable.of("key", "service three"));
 
         assertTrue(addedLatch.await(5, TimeUnit.MINUTES));
 
@@ -973,18 +944,14 @@
             ServiceRegistration<Service> serviceRegistrationOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 0);
-                    }});
+                    HashTable.of("service.ranking", 0));
 
             assertEquals(Collections.emptyList(), discards);
 
             ServiceRegistration<Service> serviceRegistrationTwo =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 1);
-                    }});
+                    HashTable.of("service.ranking", 1));
 
             assertEquals(
                 Collections.singletonList(
@@ -994,9 +961,7 @@
             ServiceRegistration<Service> serviceRegistrationMinusOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", -1);
-                    }});
+                    HashTable.of("service.ranking", -1));
 
             assertEquals(
                 Arrays.asList(
@@ -1017,9 +982,7 @@
             serviceRegistrationOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 0);
-                    }});
+                    HashTable.of("service.ranking", 0));
 
             assertEquals(
                 Arrays.asList(serviceRegistrationMinusOne.getReference()),
@@ -1045,9 +1008,7 @@
             ServiceRegistration<Service> serviceRegistrationOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 0);
-                    }});
+                    HashTable.of("service.ranking", 0));
 
             assertEquals(
                 serviceRegistrationOne.getReference(),
@@ -1056,9 +1017,7 @@
             ServiceRegistration<Service> serviceRegistrationTwo =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 1);
-                    }});
+                    HashTable.of("service.ranking", 1));
 
             assertEquals(
                 serviceRegistrationTwo.getReference(),
@@ -1067,9 +1026,7 @@
             ServiceRegistration<Service> serviceRegistrationMinusOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", -1);
-                    }});
+                    HashTable.of("service.ranking", -1));
 
             assertEquals(
                 serviceRegistrationTwo.getReference(),
@@ -1090,9 +1047,7 @@
             serviceRegistrationOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("service.ranking", 0);
-                    }});
+                    HashTable.of("service.ranking", 0));
 
             assertEquals(
                 serviceRegistrationOne.getReference(),
@@ -1247,6 +1202,7 @@
         }
     }
 
+    @SuppressWarnings("unchecked")
     @Test
     public void testDistributeWithError() {
         ArrayList<Integer> results1 = new ArrayList<>();
@@ -1340,12 +1296,14 @@
         ArrayList<Object> result = new ArrayList<>();
         ArrayList<Object> left = new ArrayList<>();
 
+        @SuppressWarnings("deprecation")
         OSGi<Integer> program = just(
             Arrays.asList(1, 2, 3, 4, 5, 6)
         ).recoverWith(
             (__, e) -> just(0)
         ).flatMap(t ->
-            onClose(() -> left.add(t)).then(just(t))
+            effects(() -> {}, () -> left.add(t)).then(
+            just(t))
         ).
         flatMap(t -> {
             if (t % 2 != 0) {
@@ -1422,7 +1380,7 @@
         };
 
         OSGi<?> program =
-            onClose(() -> closed.set(true)).foreach(
+            effects(() -> {}, () -> closed.set(true)).foreach(
             ign -> executed.set(true)
         );
 
@@ -1437,9 +1395,7 @@
             ServiceRegistration<Service> serviceRegistrationOne =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("key", "service one");
-                    }});
+                    HashTable.of("key", "service one"));
 
             assertFalse(closed.get());
             assertFalse(executed.get());
@@ -1447,9 +1403,7 @@
             ServiceRegistration<Service> serviceRegistrationTwo =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("key", "service two");
-                    }});
+                    HashTable.of("key", "service two"));
 
             assertFalse(closed.get());
             assertFalse(executed.get());
@@ -1457,9 +1411,7 @@
             ServiceRegistration<Service> serviceRegistrationThree =
                 bundleContext.registerService(
                     Service.class, new Service(),
-                    new Hashtable<String, Object>() {{
-                        put("key", "service three");
-                    }});
+                    HashTable.of("key", "service three"));
 
             assertFalse(closed.get());
             assertTrue(executed.get());
@@ -1480,6 +1432,7 @@
         ArrayList<Object> arrived = new ArrayList<>();
         ArrayList<Object> left = new ArrayList<>();
 
+        @SuppressWarnings("deprecation")
         OSGi<Integer> program = just(
             Arrays.asList(1, 2, 3, 4, 5, 6)
         ).recover(
@@ -1516,6 +1469,7 @@
         ArrayList<Object> arrived = new ArrayList<>();
         ArrayList<Object> left = new ArrayList<>();
 
+        @SuppressWarnings("deprecation")
         OSGi<Integer> program = just(
             Arrays.asList(1, 2, 3, 4, 5, 6)
         ).recoverWith(
@@ -1835,10 +1789,10 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("good", 0);
-                    put("bad", 0);
-                }});
+                HashTable.of(h -> {
+                    h.put("good", 0);
+                    h.put("bad", 0);
+                }));
 
         AtomicInteger atomicInteger = new AtomicInteger();
 
@@ -1860,18 +1814,18 @@
             assertEquals(1, atomicInteger.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("good", 0);
-                    put("bad", 1);
-                }});
+                HashTable.of(h -> {
+                    h.put("good", 0);
+                    h.put("bad", 1);
+                }));
 
             assertEquals(1, atomicInteger.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("good", 1);
-                    put("bad", 1);
-                }});
+                HashTable.of(h -> {
+                    h.put("good", 1);
+                    h.put("bad", 1);
+                }));
 
             assertEquals(2, atomicInteger.get());
         }
@@ -1887,9 +1841,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "original");
-                }});
+                HashTable.of("property", "original"));
 
         AtomicInteger atomicInteger = new AtomicInteger();
 
@@ -1919,17 +1871,13 @@
             assertEquals("original", atomicReference.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                }});
+                HashTable.of("property", "updated"));
 
             assertEquals(1, atomicInteger.get());
             assertEquals("updated", atomicReference.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "refresh");
-                }});
+                HashTable.of("property", "refresh"));
 
             assertEquals(2, atomicInteger.get());
             assertEquals("refresh", atomicReference.get());
@@ -1946,10 +1894,10 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "original");
-                    put("admissible", "true");
-                }});
+                HashTable.of(h -> {
+                    h.put("property", "original");
+                    h.put("admissible", "true");
+                }));
 
         AtomicInteger atomicInteger = new AtomicInteger();
 
@@ -1982,19 +1930,19 @@
             assertEquals("original", atomicReference.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                    put("admissible", "true");
-                }});
+                HashTable.of(h -> {
+                    h.put("property", "updated");
+                    h.put("admissible", "true");
+                }));
 
             assertEquals(1, atomicInteger.get());
             assertEquals("updated", atomicReference.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                    put("admissible", "false");
-                }});
+                HashTable.of(h -> {
+                    h.put("property", "updated");
+                    h.put("admissible", "false");
+                }));
 
             assertEquals(1, atomicInteger.get());
             assertNull(atomicReference.get());
@@ -2011,9 +1959,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "original");
-                }});
+                HashTable.of("property", "original"));
 
         AtomicInteger atomicInteger = new AtomicInteger();
 
@@ -2041,17 +1987,13 @@
             assertEquals("original", atomicReference.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                }});
+                HashTable.of("property", "updated"));
 
             assertEquals(1, atomicInteger.get());
             assertEquals("updated", atomicReference.get());
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "refresh");
-                }});
+                HashTable.of("property", "refresh"));
 
             assertEquals(2, atomicInteger.get());
             assertEquals("refresh", atomicReference.get());
@@ -2100,7 +2042,7 @@
 
         OSGi<CachingServiceReference<Service>> program =
             serviceReferences(Service.class).flatMap(ref ->
-            onClose(() -> atomicReference.set(null)).
+            effects(() -> {}, () -> atomicReference.set(null)).
             then(just(ref))
         );
 
@@ -2157,60 +2099,52 @@
         ServiceRegistration<Service> serviceRegistrationOne =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("key", new String[]{"a"});
-                }});
+                HashTable.of("key", new String[]{"a"}));
 
         assertEquals(
-            new HashMap<String, String>() {{
-                put("a", getId(serviceRegistrationOne));
-            }},
+            HashTable.of("a", getId(serviceRegistrationOne)),
             map.get());
 
         ServiceRegistration<Service> serviceRegistrationTwo =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("key", new String[]{"b"});
-                }});
+                HashTable.of("key", new String[]{"b"}));
 
         assertEquals(
-            new HashMap<String, String>() {{
-                put("a", getId(serviceRegistrationOne));
-                put("b", getId(serviceRegistrationTwo));
-            }},
+            HashTable.of(h -> {
+                h.put("a", getId(serviceRegistrationOne));
+                h.put("b", getId(serviceRegistrationTwo));
+            }),
             map.get());
 
         ServiceRegistration<Service> serviceRegistrationThree =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("key", new String[]{"a", "b"});
-                    put("service.ranking", 10);
-                }});
+                HashTable.of(h -> {
+                    h.put("key", new String[]{"a", "b"});
+                    h.put("service.ranking", 10);
+                }));
 
         assertEquals(
-            new HashMap<String, String>() {{
-                put("a", getId(serviceRegistrationThree));
-                put("b", getId(serviceRegistrationThree));
-            }},
+            HashTable.of(h -> {
+                h.put("a", getId(serviceRegistrationThree));
+                h.put("b", getId(serviceRegistrationThree));
+            }),
             map.get());
 
         serviceRegistrationThree.unregister();
 
         assertEquals(
-            new HashMap<String, String>() {{
-                put("a", getId(serviceRegistrationOne));
-                put("b", getId(serviceRegistrationTwo));
-            }},
+            HashTable.of(h -> {
+                h.put("a", getId(serviceRegistrationOne));
+                h.put("b", getId(serviceRegistrationTwo));
+            }),
             map.get());
 
         serviceRegistrationTwo.unregister();
 
         assertEquals(
-            new HashMap<String, String>() {{
-                put("a", getId(serviceRegistrationOne));
-            }},
+            HashTable.of("a", getId(serviceRegistrationOne)),
             map.get());
 
         serviceRegistrationOne.unregister();
@@ -2230,9 +2164,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "original");
-                }});
+                HashTable.of("property", "original"));
 
         try (
             OSGiResult osgiResult =
@@ -2260,9 +2192,7 @@
             assertEquals(Collections.singletonList("effect"), effects);
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                }});
+                HashTable.of("property", "updated"));
 
             assertEquals(Collections.singletonList("effect"), effects);
             assertEquals(Collections.singletonList("first"), updateEffects);
@@ -2279,9 +2209,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "original");
-                }});
+                HashTable.of("property", "original"));
 
         try (
             OSGiResult osgiResult =
@@ -2302,9 +2230,7 @@
             assertEquals(Collections.emptyList(), updateEffects);
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                }});
+                HashTable.of("property", "updated"));
 
             assertEquals(Arrays.asList("first", "second"), updateEffects);
         }
@@ -2320,9 +2246,7 @@
         ServiceRegistration<Service> serviceRegistration =
             bundleContext.registerService(
                 Service.class, new Service(),
-                new Hashtable<String, Object>() {{
-                    put("property", "original");
-                }});
+                HashTable.of("property", "original"));
 
         try (
             OSGiResult osgiResult =
@@ -2346,9 +2270,7 @@
             assertEquals(Collections.emptyList(), updateEffects);
 
             serviceRegistration.setProperties(
-                new Hashtable<String, Object>() {{
-                    put("property", "updated");
-                }});
+                HashTable.of("property", "updated"));
 
             assertEquals(Collections.emptyList(), updateEffects);
         }
diff --git a/itests/src/test/java/org/apache/aries/component/dsl/test/HashTable.java b/itests/src/test/java/org/apache/aries/component/dsl/test/HashTable.java
index 3f4a025..633f724 100644
--- a/itests/src/test/java/org/apache/aries/component/dsl/test/HashTable.java
+++ b/itests/src/test/java/org/apache/aries/component/dsl/test/HashTable.java
@@ -29,6 +29,12 @@
         return of(h -> {});
     }
 
+    public static <K, V> Hashtable<K, V> of(K k, V v) {
+        Hashtable<K, V> hashtable = new Hashtable<>();
+        hashtable.put(k, v);
+        return hashtable;
+    }
+
     public static <K, V> Hashtable<K, V> of(Consumer<Hashtable<K, V>> t) {
         Hashtable<K, V> hashtable = new Hashtable<>();
         t.accept(hashtable);