- Dictionary<String, Object> props = new Hashtable<>();
- props.put(Constants.SERVICE_PID, persistentId);
- props.put(Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName());
- props.put(Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION));
- managedServiceRegs.add(bundle.getBundleContext().registerService(ManagedService.class.getName(),
- managedService, props));
+ managedServiceRegs.add(bundle.getBundleContext().registerService(ManagedService.class, managedService,
+ FrameworkUtil.asDictionary(Map.of(
+ Constants.SERVICE_PID, persistentId,
+ Constants.BUNDLE_SYMBOLICNAME, bundle.getSymbolicName(),
+ Constants.BUNDLE_VERSION, bundle.getHeaders().get(Constants.BUNDLE_VERSION)))));