felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1656039 [2/2] - in /felix/sandbox/pderop/dependencymanager: org.apache.felix.dependencymanager.itest/src/org/apache/felix/dm/itest/api/ org.apache.felix.dependencymanager.runtime/src/org/apache/felix/dm/runtime/ org.apache.felix.dependency...
Date Fri, 30 Jan 2015 15:48:24 GMT
Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AdapterFilterIndex.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AdapterFilterIndex.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AdapterFilterIndex.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AdapterFilterIndex.java Fri Jan 30 15:48:23 2015
@@ -51,8 +51,8 @@ public class AdapterFilterIndex extends
     private final Object m_lock = new Object();
     private ServiceTracker m_tracker;
     private BundleContext m_context;
-    private final Map /* <String, List<ServiceListener>> */ m_sidToListenersMap = new HashMap();
-    protected final Map /* <ServiceListener, String> */ m_listenerToObjectClassMap = new HashMap();
+	private final Map<Object, List<ServiceListener>> m_sidToListenersMap = new HashMap<>();
+	protected final Map<ServiceListener, String> m_listenerToObjectClassMap = new HashMap<>();
 
     public void open(BundleContext context) {
         synchronized (m_lock) {
@@ -99,24 +99,24 @@ public class AdapterFilterIndex extends
 	    		String sid2 = matcher.group(3);
 	    		if (sid.equals(sid2)) {
 	    			resultData = new FilterData();
-	    			resultData.serviceId = Long.parseLong(sid);
+	    			resultData.m_serviceId = Long.parseLong(sid);
 	    		}
 	    	}
     	}
     	return resultData;
     }
 
-	public List getAllServiceReferences(String clazz, String filter) {
-		List /* <ServiceReference> */result = new ArrayList();
+	public List<ServiceReference> getAllServiceReferences(String clazz, String filter) {
+		List<ServiceReference> result = new ArrayList<>();
 		Matcher matcher = PATTERN.matcher(filter);
 		if (matcher.matches()) {
 			FilterData data = getFilterData(clazz, filter);
 			if (data != null) {
-				SortedSet /* <ServiceReference> */list = null;
+				SortedSet<ServiceReference> list = null;
 				synchronized (m_sidToServiceReferencesMap) {
-					list = (SortedSet) m_sidToServiceReferencesMap.get(Long.valueOf(data.serviceId));
+					list = m_sidToServiceReferencesMap.get(Long.valueOf(data.m_serviceId));
 					if (list != null) {
-						Iterator iterator = list.iterator();
+						Iterator<ServiceReference> iterator = list.iterator();
 						while (iterator.hasNext()) {
 							ServiceReference ref = (ServiceReference) iterator.next();
 							String objectClass = matcher.group(1);
@@ -131,17 +131,17 @@ public class AdapterFilterIndex extends
 		return result;
 	}
     
-    public void serviceChanged(ServiceEvent event) {
+	public void serviceChanged(ServiceEvent event) {
         ServiceReference reference = event.getServiceReference();
         Long sid = ServiceUtil.getServiceIdObject(reference);
-        List /* <ServiceListener> */ notificationList = new ArrayList();
+        List<ServiceListener> notificationList = new ArrayList<>();
         synchronized (m_sidToListenersMap) {
-            List /* <ServiceListener> */ list = (ArrayList) m_sidToListenersMap.get(sid);
+            List<ServiceListener> list = m_sidToListenersMap.get(sid);
             if (list != null) {
-            	Iterator iterator = list.iterator();
+            	Iterator<ServiceListener> iterator = list.iterator();
             	while (iterator.hasNext()) {
                 	ServiceListener listener = (ServiceListener) iterator.next();
-                	String objectClass = (String) m_listenerToObjectClassMap.get(listener);
+                	String objectClass = m_listenerToObjectClassMap.get(listener);
                 	if (referenceMatchesObjectClass(reference, objectClass)) {
                 		notificationList.add(listener);
                 	} 
@@ -149,21 +149,21 @@ public class AdapterFilterIndex extends
             }
         }
         // notify
-        Iterator iterator = notificationList.iterator();
+        Iterator<ServiceListener> iterator = notificationList.iterator();
         while (iterator.hasNext()) {
         	ServiceListener listener = (ServiceListener) iterator.next();
         	listener.serviceChanged(event);
         }
     }
 
-    public void addServiceListener(ServiceListener listener, String filter) {
+	public void addServiceListener(ServiceListener listener, String filter) {
         FilterData data = getFilterData(null, filter);
         if (data != null) {
-            Long sidObject = Long.valueOf(data.serviceId);
+            Long sidObject = Long.valueOf(data.m_serviceId);
             synchronized (m_sidToListenersMap) {
-            	List /* <ServiceListener> */ listeners = (List) m_sidToListenersMap.get(sidObject);
+            	List<ServiceListener> listeners = m_sidToListenersMap.get(sidObject);
             	if (listeners == null) {
-            		listeners = new ArrayList();
+            		listeners = new ArrayList<>();
             		m_sidToListenersMap.put(sidObject, listeners);
             	}
             	listeners.add(listener);
@@ -180,7 +180,7 @@ public class AdapterFilterIndex extends
         }
     }
 
-    public void removeServiceListener(ServiceListener listener) {
+	public void removeServiceListener(ServiceListener listener) {
         synchronized (m_sidToListenersMap) {
         	m_listenerToObjectClassMap.remove(listener);
             String filter = (String) m_listenerToFilterMap.remove(listener);
@@ -188,8 +188,8 @@ public class AdapterFilterIndex extends
             	// the listener does exist
             	FilterData data = getFilterData(null, filter);
             	if (data != null) {
-            		Long sidObject = Long.valueOf(data.serviceId);
-            		List /* ServiceListener */ listeners = (List) m_sidToListenersMap.get(sidObject);
+            		Long sidObject = Long.valueOf(data.m_serviceId);
+            		List<ServiceListener> listeners = m_sidToListenersMap.get(sidObject);
             		if (listeners != null) {
             			listeners.remove(listener);
             		}

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AspectFilterIndex.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AspectFilterIndex.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AspectFilterIndex.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/AspectFilterIndex.java Fri Jan 30 15:48:23 2015
@@ -19,7 +19,6 @@
 package org.apache.felix.dm.impl.index;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -55,7 +54,7 @@ public class AspectFilterIndex extends A
     private ServiceTracker m_tracker;
     private BundleContext m_context;
     
-    private final Map /* <Long, Map<String, SortedMap<Integer, Collection<ServiceListener>>> */ m_sidToObjectClassToRankingToListenersMap = new HashMap();
+	private final Map<Long, Map<String, SortedMap<Integer, List<ServiceListener>>>> m_sidToObjectClassToRankingToListenersMap = new HashMap<>();
 
     public void open(BundleContext context) {
         synchronized (m_lock) {
@@ -116,26 +115,26 @@ public class AspectFilterIndex extends A
                 return null;
             }
             FilterData result = new FilterData();
-            result.objectClass = filter.substring(FILTER_START.length(), i0);
-            result.serviceId = sid;
-            result.ranking = Integer.parseInt(filter.substring(i0 + FILTER_SUBSTRING_0.length(), i1));
+            result.m_objectClass = filter.substring(FILTER_START.length(), i0);
+            result.m_serviceId = sid;
+            result.m_ranking = Integer.parseInt(filter.substring(i0 + FILTER_SUBSTRING_0.length(), i1));
             return result;
         }
         return null;
     }
 
-    public List getAllServiceReferences(String clazz, String filter) {
-        List /* <ServiceReference> */ result = new ArrayList();
+	public List<ServiceReference> getAllServiceReferences(String clazz, String filter) {
+        List<ServiceReference> result = new ArrayList<>();
         FilterData data = getFilterData(clazz, filter);
         if (data != null) {
-        	SortedSet /* <ServiceReference> */ list = null;
+        	SortedSet<ServiceReference> list = null;
         	synchronized (m_sidToServiceReferencesMap) {
-        		list = (SortedSet) m_sidToServiceReferencesMap.get(Long.valueOf(data.serviceId));
+        		list = m_sidToServiceReferencesMap.get(Long.valueOf(data.m_serviceId));
         		if (list != null) {
-        			Iterator iterator = list.iterator();
+        			Iterator<ServiceReference> iterator = list.iterator();
         			while (iterator.hasNext()) {
         				ServiceReference reference = (ServiceReference) iterator.next();
-        				if (referenceMatchesObjectClass(reference, data.objectClass) && ServiceUtil.getRanking(reference) <= data.ranking) {
+        				if (referenceMatchesObjectClass(reference, data.m_objectClass) && ServiceUtil.getRanking(reference) <= data.m_ranking) {
         					result.add(reference);
         				}
         			}
@@ -145,8 +144,8 @@ public class AspectFilterIndex extends A
         return result;
     }
 
-    public void serviceChanged(ServiceEvent event) {
-        List list = new ArrayList();
+	public void serviceChanged(ServiceEvent event) {
+        List<ServiceListener> list = new ArrayList<>();
         ServiceReference reference = event.getServiceReference();
         Long sidObject = ServiceUtil.getServiceIdObject(reference);
         int ranking = ServiceUtil.getRanking(reference);
@@ -156,49 +155,49 @@ public class AspectFilterIndex extends A
         	for (int i = 0; i < objectClasses.length; i++) {
         		// handle each of the object classes separately since aspects only work on one object class at a time
         		String objectClass = objectClasses[i];
-        		Map /* <String, Map<Integer, Collection<ServiceListener>>> */ objectClassToRankingToListenersMap = (SortedMap) m_sidToObjectClassToRankingToListenersMap.get(sidObject);
+        		Map<String, SortedMap<Integer, List<ServiceListener>>> objectClassToRankingToListenersMap = m_sidToObjectClassToRankingToListenersMap.get(sidObject);
         		if (objectClassToRankingToListenersMap != null) {
-        			SortedMap /* Integer, ServiceListener> */ rankingToListenersMap = (SortedMap) objectClassToRankingToListenersMap.get(objectClass);
+        			SortedMap<Integer, List<ServiceListener>> rankingToListenersMap = objectClassToRankingToListenersMap.get(objectClass);
         			if (rankingToListenersMap != null) {
-        				Iterator iterator = rankingToListenersMap.entrySet().iterator();
+        				Iterator<Entry<Integer, List<ServiceListener>>> iterator = rankingToListenersMap.entrySet().iterator();
         				while (iterator.hasNext()) {
-        					Entry entry = (Entry) iterator.next();
+        					Entry<Integer, List<ServiceListener>> entry = iterator.next();
         					if (ranking <= ((Integer) entry.getKey()).intValue()) {
-        						list.addAll((Collection)entry.getValue());
+        						list.addAll(entry.getValue());
         					}
         				}
         			}
         		}
         	}
 		}
-        Iterator iterator = list.iterator();
+        Iterator<ServiceListener> iterator = list.iterator();
         while (iterator.hasNext()) {
-            ServiceListener listener = (ServiceListener) iterator.next();
+            ServiceListener listener = iterator.next();
             listener.serviceChanged(event);
         }
     }
 
-    public void addServiceListener(ServiceListener listener, String filter) {
+	public void addServiceListener(ServiceListener listener, String filter) {
         FilterData data = getFilterData(null, filter);
         if (data != null) {
-            Long sidObject = Long.valueOf(data.serviceId);
+            Long sidObject = Long.valueOf(data.m_serviceId);
             synchronized (m_sidToObjectClassToRankingToListenersMap) {
-            	Map /* <String, Map<Integer, Collection<ServiceListener>>> */ objectClassToRankingToListenersMap = (SortedMap) m_sidToObjectClassToRankingToListenersMap.get(sidObject);
+            	Map<String, SortedMap<Integer, List<ServiceListener>>> objectClassToRankingToListenersMap = m_sidToObjectClassToRankingToListenersMap.get(sidObject);
             	if (objectClassToRankingToListenersMap == null) {
-            		objectClassToRankingToListenersMap = new TreeMap();
+            		objectClassToRankingToListenersMap = new TreeMap<>();
             		m_sidToObjectClassToRankingToListenersMap.put(sidObject, objectClassToRankingToListenersMap);
             	}
             	
-            	SortedMap /* Integer, ServiceListener> */ rankingToListenersMap = (SortedMap) objectClassToRankingToListenersMap.get(data.objectClass);
+            	SortedMap<Integer, List<ServiceListener>> rankingToListenersMap = objectClassToRankingToListenersMap.get(data.m_objectClass);
                 if (rankingToListenersMap == null) {
-                    rankingToListenersMap = new TreeMap();
-                    objectClassToRankingToListenersMap.put(data.objectClass, rankingToListenersMap);
+                    rankingToListenersMap = new TreeMap<>();
+                    objectClassToRankingToListenersMap.put(data.m_objectClass, rankingToListenersMap);
                 }            	
             	
-            	Collection listeners = (Collection) rankingToListenersMap.get(Integer.valueOf(data.ranking));
+            	List<ServiceListener> listeners = rankingToListenersMap.get(Integer.valueOf(data.m_ranking));
             	if (listeners == null) {
-            		listeners = new ArrayList();
-            		rankingToListenersMap.put(Integer.valueOf(data.ranking), listeners);
+            		listeners = new ArrayList<>();
+            		rankingToListenersMap.put(Integer.valueOf(data.m_ranking), listeners);
             	}
             	
             	listeners.add(listener);
@@ -207,7 +206,7 @@ public class AspectFilterIndex extends A
         }
     }
 
-    public void removeServiceListener(ServiceListener listener) {
+	public void removeServiceListener(ServiceListener listener) {
     	synchronized (m_sidToObjectClassToRankingToListenersMap) {
     		String filter = (String) m_listenerToFilterMap.remove(listener);
     		if (filter != null) {
@@ -215,21 +214,21 @@ public class AspectFilterIndex extends A
     			FilterData data = getFilterData(null, filter);
     			if (data != null) {
     				// this index is applicable
-    				Long sidObject = Long.valueOf(data.serviceId);
-                	Map /* <String, Map<Integer, Collection<ServiceListener>>> */ objectClassToRankingToListenersMap = (SortedMap) m_sidToObjectClassToRankingToListenersMap.get(sidObject);
+    				Long sidObject = Long.valueOf(data.m_serviceId);
+                	Map<String, SortedMap<Integer, List<ServiceListener>>> objectClassToRankingToListenersMap = m_sidToObjectClassToRankingToListenersMap.get(sidObject);
                 	if (objectClassToRankingToListenersMap != null) {
-                		SortedMap /* Integer, ServiceListener> */ rankingToListenersMap = (SortedMap) objectClassToRankingToListenersMap.get(data.objectClass);
+                		SortedMap<Integer, List<ServiceListener>> rankingToListenersMap = objectClassToRankingToListenersMap.get(data.m_objectClass);
                 		if (rankingToListenersMap != null) {
-                			Collection listeners = (Collection) rankingToListenersMap.get(Integer.valueOf(data.ranking));
+                			List<ServiceListener> listeners = rankingToListenersMap.get(Integer.valueOf(data.m_ranking));
                 			if (listeners != null) {
                 				listeners.remove(listener);
                 			}
                 			// cleanup 
                 			if (listeners != null && listeners.isEmpty()) {
-                				rankingToListenersMap.remove(Integer.valueOf(data.ranking));
+                				rankingToListenersMap.remove(Integer.valueOf(data.m_ranking));
                 			}
                 			if (rankingToListenersMap.isEmpty()) {
-                				objectClassToRankingToListenersMap.remove(data.objectClass);
+                				objectClassToRankingToListenersMap.remove(data.m_objectClass);
                 			}
                 			if (objectClassToRankingToListenersMap.isEmpty()) {
                 				m_sidToObjectClassToRankingToListenersMap.remove(sidObject);

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptor.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptor.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptor.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptor.java Fri Jan 30 15:48:23 2015
@@ -23,7 +23,7 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.apache.felix.dm.FilterIndex;
-import org.apache.felix.dm.impl.Logger;
+import org.apache.felix.dm.Logger;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.framework.InvalidSyntaxException;
@@ -34,19 +34,18 @@ import org.osgi.framework.ServiceReferen
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-@SuppressWarnings("unchecked")
 public class BundleContextInterceptor extends BundleContextInterceptorBase {
 	protected static final String INDEX_LOG_TRESHOLD = "org.apache.felix.dm.index.log.treshold";
     private final ServiceRegistryCache m_cache;
     private final boolean m_perfmon = System.getProperty(INDEX_LOG_TRESHOLD) != null;
 	private Logger m_logger;
-	private long m_treshold;
+	private long m_threshold;
 
     public BundleContextInterceptor(ServiceRegistryCache cache, BundleContext context) {
         super(context);
         m_cache = cache;
 		if (m_perfmon) {
-			m_treshold = Long.parseLong(System.getProperty(INDEX_LOG_TRESHOLD));
+			m_threshold = Long.parseLong(System.getProperty(INDEX_LOG_TRESHOLD));
 			m_logger = new Logger(context);
 		}
     }
@@ -57,7 +56,6 @@ public class BundleContextInterceptor ex
             filterIndex.addServiceListener(listener, filter);
         }
         else {
-//            System.out.println("BCI:Listener " + listener.getClass().getName() + " filter " + filter);
             m_context.addServiceListener(listener, filter);
         }
     }
@@ -68,22 +66,21 @@ public class BundleContextInterceptor ex
             filterIndex.addServiceListener(listener, null);
         }
         else {
-//            System.out.println("BCI:Listener " + listener.getClass().getName() + " without filter");
             m_context.addServiceListener(listener);
         }
     }
 
-    public void removeServiceListener(ServiceListener listener) {
+	public void removeServiceListener(ServiceListener listener) {
     	// remove servicelistener. although it would be prettier to find the correct filterindex first it's
     	// probaby faster to do a brute force removal.
-    	Iterator filterIndexIterator = m_cache.getFilterIndices().iterator();
+    	Iterator<FilterIndex> filterIndexIterator = m_cache.getFilterIndices().iterator();
     	while (filterIndexIterator.hasNext()) {
-    		((FilterIndex) filterIndexIterator.next()).removeServiceListener(listener);
+    		filterIndexIterator.next().removeServiceListener(listener);
     	}
     	m_context.removeServiceListener(listener);
     }
 
-    public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
+	public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
     	long start = 0L;
     	if (m_perfmon) {
     		start = System.currentTimeMillis();
@@ -91,10 +88,10 @@ public class BundleContextInterceptor ex
         // first we ask the cache if there is an index for our request (class and filter combination)
         FilterIndex filterIndex = m_cache.hasFilterIndexFor(clazz, filter);
         if (filterIndex != null) {
-            List /* <ServiceReference> */ result = filterIndex.getAllServiceReferences(clazz, filter);
-            Iterator iterator = result.iterator();
+            List<ServiceReference> result = filterIndex.getAllServiceReferences(clazz, filter);
+            Iterator<ServiceReference> iterator = result.iterator();
             while (iterator.hasNext()) {
-                ServiceReference reference = (ServiceReference) iterator.next();
+                ServiceReference reference = iterator.next();
                 String[] list = (String[]) reference.getProperty(Constants.OBJECTCLASS);
                 for (int i = 0; i < list.length; i++) {
                     if (!reference.isAssignableTo(m_context.getBundle(), list[i])) {
@@ -105,8 +102,8 @@ public class BundleContextInterceptor ex
             }
             if (m_perfmon) {
 	        	long duration = System.currentTimeMillis() - start;
-	        	if (duration > m_treshold) {
-	        		m_logger.log(Logger.LOG_DEBUG, "Indexed filter exceeds lookup time treshold (" + duration + "ms.): " + clazz + " " + filter);
+	        	if (duration > m_threshold) {
+	        		m_logger.log(Logger.LOG_DEBUG, "Indexed filter exceeds lookup time threshold (" + duration + " ms): " + clazz + " " + filter);
 	        	}
             }
             if (result.size() == 0) {
@@ -119,19 +116,19 @@ public class BundleContextInterceptor ex
             ServiceReference[] serviceReferences = m_context.getServiceReferences(clazz, filter);
             if (m_perfmon) {
 	        	long duration = System.currentTimeMillis() - start;
-	        	if (duration > m_treshold) {
-	        		m_logger.log(Logger.LOG_DEBUG, "Unindexed filter exceeds lookup time treshold (" + duration + "ms.): " + clazz + " " + filter);
+	        	if (duration > m_threshold) {
+	        		m_logger.log(Logger.LOG_DEBUG, "Unindexed filter exceeds lookup time threshold (" + duration + " ms): " + clazz + " " + filter);
 	        	}
             }
         	return serviceReferences;
         }
     }
 
-    public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
+	public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException {
         // first we ask the cache if there is an index for our request (class and filter combination)
         FilterIndex filterIndex = m_cache.hasFilterIndexFor(clazz, filter);
         if (filterIndex != null) {
-            List /* <ServiceReference> */ result = filterIndex.getAllServiceReferences(clazz, filter);
+            List<ServiceReference> result = filterIndex.getAllServiceReferences(clazz, filter);
             if (result == null || result.size() == 0) {
                 return null;
             }

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptorBase.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptorBase.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptorBase.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/BundleContextInterceptorBase.java Fri Jan 30 15:48:23 2015
@@ -44,10 +44,10 @@ import org.osgi.framework.ServiceRegistr
 public abstract class BundleContextInterceptorBase implements BundleContext, ServiceListener {
     protected final BundleContext m_context;
     /** Keeps track of all service listeners and their optional filters. */
-    private final Map /* <ServiceListener, String> */m_serviceListenerFilterMap = new HashMap();
+	private final Map<ServiceListener, String> m_serviceListenerFilterMap = new HashMap<>();
     private long m_currentVersion = 0;
     private long m_entryVersion = -1;
-    private Entry[] m_serviceListenerFilterMapEntries;
+	private Entry<ServiceListener, String>[] m_serviceListenerFilterMapEntries;
 
     public BundleContextInterceptorBase(BundleContext context) {
         m_context = context;
@@ -77,14 +77,14 @@ public abstract class BundleContextInter
         return m_context.getBundles();
     }
 
-    public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException {
+	public void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException {
         synchronized (m_serviceListenerFilterMap) {
             m_serviceListenerFilterMap.put(listener, filter);
             m_currentVersion++;
         }
     }
 
-    public void addServiceListener(ServiceListener listener) {
+	public void addServiceListener(ServiceListener listener) {
         synchronized (m_serviceListenerFilterMap) {
             m_serviceListenerFilterMap.put(listener, null);
             m_currentVersion++;
@@ -114,11 +114,11 @@ public abstract class BundleContextInter
         m_context.removeFrameworkListener(listener);
     }
 
-    public ServiceRegistration registerService(String[] clazzes, Object service, Dictionary properties) {
+    public ServiceRegistration registerService(String[] clazzes, Object service, @SuppressWarnings("rawtypes") Dictionary properties) {
         return m_context.registerService(clazzes, service, properties);
     }
 
-    public ServiceRegistration registerService(String clazz, Object service, Dictionary properties) {
+    public ServiceRegistration registerService(String clazz, Object service, @SuppressWarnings("rawtypes") Dictionary properties) {
         return m_context.registerService(clazz, service, properties);
     }
 
@@ -150,11 +150,12 @@ public abstract class BundleContextInter
         return m_context.createFilter(filter);
     }
 
-    protected Entry[] synchronizeCollection() {
+	@SuppressWarnings("unchecked")
+	protected Entry<ServiceListener, String>[] synchronizeCollection() {
         // lazy copy on write: we make a new copy only if writes have changed the collection
         synchronized (m_serviceListenerFilterMap) {
             if (m_currentVersion != m_entryVersion) {
-                m_serviceListenerFilterMapEntries = (Entry[]) m_serviceListenerFilterMap.entrySet().toArray(new Entry[m_serviceListenerFilterMap.size()]);
+                m_serviceListenerFilterMapEntries = (Entry<ServiceListener, String>[]) m_serviceListenerFilterMap.entrySet().toArray(new Entry[m_serviceListenerFilterMap.size()]);
                 m_entryVersion = m_currentVersion;
             }
         }

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/FilterIndexBundleContext.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/FilterIndexBundleContext.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/FilterIndexBundleContext.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/FilterIndexBundleContext.java Fri Jan 30 15:48:23 2015
@@ -33,12 +33,12 @@ public class FilterIndexBundleContext ex
         super(context);
     }
 
-    public void serviceChanged(ServiceEvent event) {
-        Entry[] entries = synchronizeCollection();
+	public void serviceChanged(ServiceEvent event) {
+        Entry<ServiceListener, String>[] entries = synchronizeCollection();
         for (int i = 0; i < entries.length; i++) {
-            Entry serviceListenerFilterEntry = entries[i];
-            ServiceListener serviceListener = (ServiceListener) serviceListenerFilterEntry.getKey();
-            String filter = (String) serviceListenerFilterEntry.getValue();
+            Entry<ServiceListener, String> serviceListenerFilterEntry = entries[i];
+            ServiceListener serviceListener = serviceListenerFilterEntry.getKey();
+            String filter = serviceListenerFilterEntry.getValue();
             if (filter == null) {
                 serviceListener.serviceChanged(event);
             }

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/ServiceRegistryCache.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/ServiceRegistryCache.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/ServiceRegistryCache.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/ServiceRegistryCache.java Fri Jan 30 15:48:23 2015
@@ -28,20 +28,17 @@ import org.apache.felix.dm.FilterIndex;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceEvent;
 import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceRegistration;
 
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class ServiceRegistryCache implements ServiceListener/*, CommandProvider*/ {
-	private final List /* <FilterIndex> */ m_filterIndexList = new CopyOnWriteArrayList();
+	private final List<FilterIndex> m_filterIndexList = new CopyOnWriteArrayList<>();
     private final BundleContext m_context;
     private final FilterIndexBundleContext m_filterIndexBundleContext;
-    private final Map /* <BundleContext, BundleContextInterceptor> */ m_bundleContextInterceptorMap = new HashMap();
+	private final Map<BundleContext, BundleContextInterceptor> m_bundleContextInterceptorMap = new HashMap<>();
     private long m_currentVersion = 0;
     private long m_arrayVersion = -1;
-    private BundleContextInterceptor[] m_interceptors = null;
-    private ServiceRegistration m_registration;
     
     public ServiceRegistryCache(BundleContext context) {
         m_context = context;
@@ -50,11 +47,9 @@ public class ServiceRegistryCache implem
     
     public void open() {
         m_context.addServiceListener(this);
-//        m_registration = m_context.registerService(CommandProvider.class.getName(), this, null);
     }
     
     public void close() {
-//        m_registration.unregister();
         m_context.removeServiceListener(this);
     }
     
@@ -75,7 +70,6 @@ public class ServiceRegistryCache implem
         synchronized (m_bundleContextInterceptorMap) {
             if (m_currentVersion != m_arrayVersion) {
                 // if our copy is out of date, we make a new one
-                m_interceptors = (BundleContextInterceptor[]) m_bundleContextInterceptorMap.values().toArray(new BundleContextInterceptor[m_bundleContextInterceptorMap.size()]);
                 m_arrayVersion = m_currentVersion;
             }
         }
@@ -86,7 +80,7 @@ public class ServiceRegistryCache implem
     /** Creates an interceptor for a bundle context that uses our cache. */
     public BundleContext createBundleContextInterceptor(BundleContext context) {
         synchronized (m_bundleContextInterceptorMap) {
-            BundleContextInterceptor bundleContextInterceptor = (BundleContextInterceptor) m_bundleContextInterceptorMap.get(context);
+            BundleContextInterceptor bundleContextInterceptor = m_bundleContextInterceptorMap.get(context);
             if (bundleContextInterceptor == null) {
                 bundleContextInterceptor = new BundleContextInterceptor(this, context);
                 m_bundleContextInterceptorMap.put(context, bundleContextInterceptor);
@@ -98,9 +92,9 @@ public class ServiceRegistryCache implem
     }
 
     public FilterIndex hasFilterIndexFor(String clazz, String filter) {
-        Iterator iterator = m_filterIndexList.iterator();
+        Iterator<FilterIndex> iterator = m_filterIndexList.iterator();
         while (iterator.hasNext()) {
-            FilterIndex filterIndex = (FilterIndex) iterator.next();
+            FilterIndex filterIndex = iterator.next();
             if (filterIndex.isApplicable(clazz, filter)) {
                 return filterIndex;
             }
@@ -109,56 +103,12 @@ public class ServiceRegistryCache implem
     }
 
     public void serviceChangedForFilterIndices(ServiceEvent event) {
-        Iterator iterator = m_filterIndexList.iterator();
+        Iterator<FilterIndex> iterator = m_filterIndexList.iterator();
         while (iterator.hasNext()) {
-            FilterIndex filterIndex = (FilterIndex) iterator.next();
+            FilterIndex filterIndex = iterator.next();
             filterIndex.serviceChanged(event);
         }
     }
-
-//    public void _sc(CommandInterpreter ci) {
-//        ci.println(toString());
-//    }
-//    
-//    public void _fi(CommandInterpreter ci) {
-//        String arg = ci.nextArgument();
-//        if (arg != null) {
-//            int x = Integer.parseInt(arg);
-//            FilterIndex filterIndex = (FilterIndex) m_filterIndexList.get(x);
-//            String a1 = ci.nextArgument();
-//            String a2 = null;
-//            if (a1 != null) {
-//                if ("-".equals(a1)) {
-//                    a1 = null;
-//                }
-//                a2 = ci.nextArgument();
-//            }
-//            if (filterIndex.isApplicable(a1, a2)) {
-//                List /* <ServiceReference> */ references = filterIndex.getAllServiceReferences(a1, a2);
-//                ci.println("Found " + references.size() + " references:");
-//                for (int i = 0; i < references.size(); i++) {
-//                    ci.println("" + i + " - " + references.get(i));
-//                }
-//            }
-//            else {
-//                ci.println("Filter not applicable.");
-//            }
-//        }
-//        else {
-//            ci.println("FilterIndices:");
-//            Iterator iterator = m_filterIndexList.iterator();
-//            int index = 0;
-//            while (iterator.hasNext()) {
-//                FilterIndex filterIndex = (FilterIndex) iterator.next();
-//                ci.println("" + index + " " + filterIndex);
-//                index++;
-//            }
-//        }
-//    }
-//    
-//    public String getHelp() {
-//        return "I'm not going to help you!";
-//    }
     
     public String toString() {
         StringBuffer sb = new StringBuffer();
@@ -169,7 +119,7 @@ public class ServiceRegistryCache implem
         return sb.toString();
     }
 
-	public List getFilterIndices() {
+	public List<FilterIndex> getFilterIndices() {
 		return m_filterIndexList;
 	}
 }

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Filter.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Filter.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Filter.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Filter.java Fri Jan 30 15:48:23 2015
@@ -29,13 +29,11 @@ import java.util.TreeSet;
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class Filter {
-	
 	private boolean m_valid = true;
-	private Map /* <String, Property> */ m_properties = new HashMap();
-	private Set /* <String> */ m_propertyKeys = new TreeSet(String.CASE_INSENSITIVE_ORDER);
+	private Map<String, Property> m_properties = new HashMap<>();
+	private Set<String> m_propertyKeys = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
 	
 	private Filter() {
-		
 	}
 	
 	// Sample valid filter string (&(objectClass=OBJECTCLASS)(&(model=MODEL)(concept=CONCEPT)(role=ROLE)(!(context=*))))
@@ -69,7 +67,7 @@ public class Filter {
 					// set complete
 					if (filter.m_properties.containsKey(key)) {
 						// set current property to multivalue
-						Property property = (Property) filter.m_properties.get(key);
+						Property property = filter.m_properties.get(key);
 						property.addValue(valueBuilder.toString(), negate);
 					} else {
 						Property property = new Property(negate, key, valueBuilder.toString());
@@ -89,12 +87,12 @@ public class Filter {
 		return m_properties.containsKey(propertyKey);
 	}
 	
-	public Set /* <String> */ getPropertyKeys() {
+	public Set<String> getPropertyKeys() {
 		return m_properties.keySet();
 	}
 	
 	public Property getProperty(String key) {
-		return (Property) m_properties.get(key);
+		return m_properties.get(key);
 	}
 	
 	public boolean isValid() {
@@ -102,9 +100,9 @@ public class Filter {
 			return m_valid;
 		} else {
 			// also check the properties
-			Iterator propertiesIterator = m_properties.values().iterator();
+			Iterator<Property> propertiesIterator = m_properties.values().iterator();
 			while (propertiesIterator.hasNext()) {
-				Property property = (Property) propertiesIterator.next();
+				Property property = propertiesIterator.next();
 				if (!property.isValid()) {
 					return false;
 				}
@@ -120,15 +118,15 @@ public class Filter {
 
 	protected String createKey() {
 		StringBuilder builder = new StringBuilder();
-		Iterator keys = m_propertyKeys.iterator();
+		Iterator<String> keys = m_propertyKeys.iterator();
 		
 		while (keys.hasNext()) {
-			String key = (String) keys.next();
-			Property prop = (Property) m_properties.get(key);
+			String key = keys.next();
+			Property prop = m_properties.get(key);
 			if (!prop.isWildcard()) {
-				Iterator values = prop.getValues().iterator();
+				Iterator<String> values = prop.getValues().iterator();
 				while (values.hasNext()) {
-					String value = (String) values.next();
+					String value = values.next();
 					builder.append(key);
 					builder.append("=");
 					builder.append(value);

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/MultiPropertyFilterIndex.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/MultiPropertyFilterIndex.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/MultiPropertyFilterIndex.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/MultiPropertyFilterIndex.java Fri Jan 30 15:48:23 2015
@@ -48,11 +48,11 @@ public class MultiPropertyFilterIndex im
     private final Object m_lock = new Object();
     private ServiceTracker m_tracker;
     private BundleContext m_context;
-	private Map /* <String, Property> */ m_configProperties = new LinkedHashMap();
-	private List /* <String> */ m_negatePropertyKeys = new ArrayList();
-    private final Map /* <String, List<ServiceReference>> */ m_keyToServiceReferencesMap = new HashMap();
-    private final Map /* <String, List<ServiceListener>> */ m_keyToListenersMap = new HashMap();
-    private final Map /* <ServiceListener, String> */ m_listenerToFilterMap = new HashMap();
+	private Map<String, Property> m_configProperties = new LinkedHashMap<>();
+	private List<String> m_negatePropertyKeys = new ArrayList<>();
+    private final Map<String, List<ServiceReference>> m_keyToServiceReferencesMap = new HashMap<>();
+    private final Map<String, List<ServiceListener>> m_keyToListenersMap = new HashMap<>();
+    private final Map<ServiceListener, String> m_listenerToFilterMap = new HashMap<>();
 
 	public MultiPropertyFilterIndex(String configString) {
 		parseConfig(configString);
@@ -65,16 +65,16 @@ public class MultiPropertyFilterIndex im
 			return false;
 		}
 		// compare property keys to the ones in the configuration
-		Set /* <String> */ filterPropertyKeys = filter.getPropertyKeys();
+		Set<String> filterPropertyKeys = filter.getPropertyKeys();
 		if (m_configProperties.size() != filterPropertyKeys.size()) {
 			return false;
 		}
-		Iterator filterPropertyKeysIterator = filterPropertyKeys.iterator();
+		Iterator<String> filterPropertyKeysIterator = filterPropertyKeys.iterator();
 		while (filterPropertyKeysIterator.hasNext()) {
-			String filterPropertyKey = (String) filterPropertyKeysIterator.next();
+			String filterPropertyKey = filterPropertyKeysIterator.next();
 			if (!m_configProperties.containsKey(filterPropertyKey)) {
 				return false;
-			} else if (((Property)m_configProperties.get(filterPropertyKey)).isNegate() != filter.getProperty(filterPropertyKey).isNegate()) {
+			} else if ((m_configProperties.get(filterPropertyKey)).isNegate() != filter.getProperty(filterPropertyKey).isNegate()) {
 				// negation should be equal
 				return false;
 			} else if (!filter.getProperty(filterPropertyKey).isNegate() && filter.getProperty(filterPropertyKey).getValue().equals("*")) {
@@ -88,14 +88,14 @@ public class MultiPropertyFilterIndex im
 	
     public boolean isApplicable(ServiceReference ref) {
     	String[] propertyKeys = ref.getPropertyKeys();
-        TreeSet referenceProperties = new TreeSet(String.CASE_INSENSITIVE_ORDER);
+        TreeSet<String> referenceProperties = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
         for (int i = 0; i < propertyKeys.length; i++) {
             referenceProperties.add(propertyKeys[i]);
         }
-        Iterator iterator = m_configProperties.keySet().iterator();
+        Iterator<String> iterator = m_configProperties.keySet().iterator();
         while (iterator.hasNext()) {
-            String item = (String) iterator.next();
-            Property configProperty = (Property) m_configProperties.get(item);
+            String item = iterator.next();
+            Property configProperty = m_configProperties.get(item);
             if (!configProperty.isNegate() && !(referenceProperties.contains(item))) {
                 return false;
             } else if (configProperty.isNegate() && referenceProperties.contains(item)) {
@@ -131,7 +131,7 @@ public class MultiPropertyFilterIndex im
 		}
 	}
 	
-	protected Collection /* <Property> */ getProperties() {
+	protected Collection<Property> getProperties() {
 		return m_configProperties.values();
 	}
 	
@@ -154,13 +154,13 @@ public class MultiPropertyFilterIndex im
 		return filter;
     }
     
-    protected List createKeys(ServiceReference reference) {
-    	List /* <String> */ results = new ArrayList();
-    	List sets = new ArrayList();   	
+    protected List<String> createKeys(ServiceReference reference) {
+    	List<String> results = new ArrayList<>();
+    	List<List<String>> sets = new ArrayList<>();   	
     	String[] keys = reference.getPropertyKeys();
     	Arrays.sort(keys, String.CASE_INSENSITIVE_ORDER);
     	for (int i = 0; i < keys.length; i++) {
-    		List set = new ArrayList();
+    		List<String> set = new ArrayList<>();
     		String key = keys[i].toLowerCase();
     		if (m_configProperties.containsKey(key)) {
 	    		Object valueObject = reference.getProperty(key);
@@ -173,18 +173,18 @@ public class MultiPropertyFilterIndex im
     		}
     	}
     	
-    	List reversedSets = new ArrayList();
+    	List<List<String>> reversedSets = new ArrayList<>();
     	int size = sets.size();
     	for (int i = size - 1; i > -1; i--) {
     		reversedSets.add(sets.get(i));
     	}
-    	List products = carthesianProduct(0, reversedSets);
+    	List<List<String>> products = carthesianProduct(0, reversedSets);
     	// convert sets into strings
     	for (int i = 0; i < products.size(); i++) {
-    		List set = (List) products.get(i);
+    		List<String> set = products.get(i);
     		StringBuilder b = new StringBuilder();
     		for (int j = 0; j < set.size(); j++) {
-    			String item = (String) set.get(j);
+    			String item = set.get(j);
     			b.append(item);
     			if (j < set.size() - 1) {
     				b.append(";");
@@ -204,17 +204,17 @@ public class MultiPropertyFilterIndex im
      * @param sets
      * @return
      */
-    private List carthesianProduct(int index, List sets) {
-    	List result = new ArrayList();
+    private List<List<String>> carthesianProduct(int index, List<List<String>> sets) {
+    	List<List<String>> result = new ArrayList<>();
     	if (index == sets.size()) {
-    		result.add(new ArrayList());
+    		result.add(new ArrayList<String>());
     	} else {
-			List set = (List) sets.get(index);
+			List<String> set = sets.get(index);
 			for (int i = 0; i < set.size(); i++) {
-				Object object = set.get(i);
-    			List pSets = carthesianProduct(index + 1, sets);
+				String object = set.get(i);
+    			List<List<String>> pSets = carthesianProduct(index + 1, sets);
     			for (int j = 0; j < pSets.size(); j++) {
-    				List pSet = (List) pSets.get(j);
+    				List<String> pSet = pSets.get(j);
     				pSet.add(object);
     				result.add(pSet);
     			}
@@ -223,18 +223,18 @@ public class MultiPropertyFilterIndex im
     	return result;
     }
     
-    List getPermutations(String key, String[] values) {
-    	List results = new ArrayList();
+    List<String> getPermutations(String key, String[] values) {
+    	List<String> results = new ArrayList<>();
 		Arrays.sort(values, String.CASE_INSENSITIVE_ORDER);
 		for (int v = 0; v < values.length; v++) {
 			String processValue = values[v];
-			List /* <String> */ items = new ArrayList();
+			List<String> items = new ArrayList<>();
 			items.add(processValue);
 			// per value get combinations
-			List /* <String> */ subItems = new ArrayList(items);
+			List<String> subItems = new ArrayList<>(items);
 			for (int w = v; w < values.length; w++) {
 				// make a copy of the current list
-				subItems = new ArrayList(subItems);
+				subItems = new ArrayList<>(subItems);
 				if (w != v) {
 					String value = values[w];
 					subItems.add(value);
@@ -245,10 +245,10 @@ public class MultiPropertyFilterIndex im
 		return results;
     }
     
-    protected String toKey(String key, List values) {
+    protected String toKey(String key, List<String> values) {
     	StringBuilder builder = new StringBuilder();
     	for (int i = 0; i < values.size(); i++) {
-    		builder.append(toKey(key, (String) values.get(i)));
+    		builder.append(toKey(key, values.get(i)));
     		if (i < values.size() - 1) {
     			builder.append(";");
     		}
@@ -296,12 +296,12 @@ public class MultiPropertyFilterIndex im
     }
     
     protected void handleServiceAdd(ServiceReference reference) {
-        List /* <String> */ keys = createKeys(reference);
+        List<String> keys = createKeys(reference);
         synchronized (m_keyToServiceReferencesMap) {
             for (int i = 0; i < keys.size(); i++) {
-                List /* <ServiceReference> */ references = (List) m_keyToServiceReferencesMap.get(keys.get(i));
+                List<ServiceReference> references = m_keyToServiceReferencesMap.get(keys.get(i));
                 if (references == null) {
-                    references = new ArrayList();
+                    references = new ArrayList<>();
                     m_keyToServiceReferencesMap.put(keys.get(i), references);
                 }
                 references.add(reference);
@@ -315,13 +315,13 @@ public class MultiPropertyFilterIndex im
             // TODO this is a quite expensive linear scan over the existing collection
             // because we first need to remove any existing references and they can be
             // all over the place :)
-            Iterator iterator = m_keyToServiceReferencesMap.values().iterator();
+            Iterator<List<ServiceReference>> iterator = m_keyToServiceReferencesMap.values().iterator();
             while (iterator.hasNext()) {
-                List /* <ServiceReference> */ list = (List) iterator.next();
+                List<ServiceReference> list = iterator.next();
                 if (list != null) {
-                    Iterator i2 = list.iterator();
+                    Iterator<ServiceReference> i2 = list.iterator();
                     while (i2.hasNext()) {
-                        ServiceReference ref = (ServiceReference) i2.next();
+                        ServiceReference ref = i2.next();
                         if (ref.equals(reference)) {
                             i2.remove();
                         }
@@ -330,11 +330,11 @@ public class MultiPropertyFilterIndex im
             }
             // only re-add the reference when it is still applicable for this filter index
             if (shouldBeIndexed(reference)) {
-            	List /* <String> */ keys = createKeys(reference);
+            	List<String> keys = createKeys(reference);
 	            for (int i = 0; i < keys.size(); i++) {
-	                List /* <ServiceReference> */ references = (List) m_keyToServiceReferencesMap.get(keys.get(i));
+	                List<ServiceReference> references = m_keyToServiceReferencesMap.get(keys.get(i));
 	                if (references == null) {
-	                    references = new ArrayList();
+	                    references = new ArrayList<>();
 	                    m_keyToServiceReferencesMap.put(keys.get(i), references);
 	                }
 	                references.add(reference);
@@ -344,10 +344,10 @@ public class MultiPropertyFilterIndex im
     }
 
     protected void handleServiceRemove(ServiceReference reference) {
-        List /* <String> */ keys = createKeys(reference);
+        List<String> keys = createKeys(reference);
         synchronized (m_keyToServiceReferencesMap) {
             for (int i = 0; i < keys.size(); i++) {
-                List /* <ServiceReference> */ references = (List) m_keyToServiceReferencesMap.get(keys.get(i));
+                List<ServiceReference> references = m_keyToServiceReferencesMap.get(keys.get(i));
                 if (references != null) {
                     references.remove(reference);
                     if (references.isEmpty()) {
@@ -360,9 +360,9 @@ public class MultiPropertyFilterIndex im
     
     protected boolean shouldBeIndexed(ServiceReference reference) {
     	// is already applicable, so we should only check whether there's a negate field in the filter which has a value in the reference
-    	Iterator negatePropertyKeyIterator = m_negatePropertyKeys.iterator();
+    	Iterator<String> negatePropertyKeyIterator = m_negatePropertyKeys.iterator();
     	while (negatePropertyKeyIterator.hasNext()) {
-    		String negatePropertyKey = (String) negatePropertyKeyIterator.next();
+    		String negatePropertyKey = negatePropertyKeyIterator.next();
     		if (reference.getProperty(negatePropertyKey) != null) {
     			return false;
     		}
@@ -399,12 +399,11 @@ public class MultiPropertyFilterIndex im
         tracker.close();
 	}
 
-    public List /* <ServiceReference> */ getAllServiceReferences(String clazz, String filter) {
-        List /* <ServiceReference> */ result = new ArrayList();
+    public List<ServiceReference> getAllServiceReferences(String clazz, String filter) {
+        List<ServiceReference> result = new ArrayList<>();
         String key = createKeyFromFilter(clazz, filter);
-        ServiceReference reference;
         synchronized (m_keyToServiceReferencesMap) {
-            List references = (List) m_keyToServiceReferencesMap.get(key);
+            List<ServiceReference> references = m_keyToServiceReferencesMap.get(key);
             if (references != null) {
                 result.addAll(references);
             }
@@ -414,21 +413,21 @@ public class MultiPropertyFilterIndex im
 
     public void serviceChanged(ServiceEvent event) {
         if (isApplicable(event.getServiceReference())) {
-            List /* <String> */ keys = createKeys(event.getServiceReference());
-            List list = new ArrayList();
+            List<String> keys = createKeys(event.getServiceReference());
+            List<ServiceListener> list = new ArrayList<ServiceListener>();
             synchronized (m_keyToListenersMap) {
                 for (int i = 0; i < keys.size(); i++) {
-                    String key = (String) keys.get(i);
-                    List listeners = (List) m_keyToListenersMap.get(key);
+                    String key = keys.get(i);
+                    List<ServiceListener> listeners = m_keyToListenersMap.get(key);
                     if (listeners != null) {
                         list.addAll(listeners);
                     }
                 }
             }
             if (list != null) {
-                Iterator iterator = list.iterator();
+                Iterator<ServiceListener> iterator = list.iterator();
                 while (iterator.hasNext()) {
-                    ServiceListener listener = (ServiceListener) iterator.next();
+                    ServiceListener listener = iterator.next();
                     listener.serviceChanged(event);
                 }
             }
@@ -438,9 +437,9 @@ public class MultiPropertyFilterIndex im
     public void addServiceListener(ServiceListener listener, String filter) {
         String key = createKeyFromFilter(null, filter);
         synchronized (m_keyToListenersMap) {
-            List /* <ServiceListener> */ listeners = (List) m_keyToListenersMap.get(key);
+            List<ServiceListener> listeners = m_keyToListenersMap.get(key);
             if (listeners == null) {
-                listeners = new CopyOnWriteArrayList();
+                listeners = new CopyOnWriteArrayList<ServiceListener>();
                 m_keyToListenersMap.put(key, listeners);
             }
             listeners.add(listener);
@@ -450,14 +449,14 @@ public class MultiPropertyFilterIndex im
 
     public void removeServiceListener(ServiceListener listener) {
         synchronized (m_keyToListenersMap) {
-            String filter = (String) m_listenerToFilterMap.remove(listener);
+            String filter = m_listenerToFilterMap.remove(listener);
             if (filter != null) {
             	// the listener does exist
         		String key = createKeyFromFilter(null, filter);
         		
         		boolean result = filter != null;
         		if (result) {
-        			List /* <ServiceListener> */ listeners = (List) m_keyToListenersMap.get(key);
+        			List<ServiceListener> listeners = m_keyToListenersMap.get(key);
         			if (listeners != null) {
         				listeners.remove(listener);
         				if (listeners.isEmpty()) {
@@ -470,7 +469,7 @@ public class MultiPropertyFilterIndex im
         }
     }
     
-    protected Collection getServiceListeners() {
+    protected Collection<ServiceListener> getServiceListeners() {
     	return m_listenerToFilterMap.keySet();
     }
     

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Property.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Property.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Property.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/index/multiproperty/Property.java Fri Jan 30 15:48:23 2015
@@ -29,17 +29,17 @@ public class Property {
 	boolean m_valid = true;
 	String m_key;
 	String m_value;
-	Set m_values = new TreeSet(String.CASE_INSENSITIVE_ORDER);
+	Set<String> m_values = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
 	
 	public Property() {
 	}
 	
 	public Property(boolean negate, String key, String value) {
 		super();
-		this.m_negate = negate;
-		this.m_key = key.toLowerCase();
-		this.m_values.add(value);
-		this.m_value = value;
+		m_negate = negate;
+		m_key = key.toLowerCase();
+		m_values.add(value);
+		m_value = value;
 	}
 
 	public void setNegate(boolean negate) {
@@ -76,7 +76,7 @@ public class Property {
 		return m_value;
 	}
 	
-	public Set getValues() {
+	public Set<String> getValues() {
 		return m_values;
 	}
 	

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java Fri Jan 30 15:48:23 2015
@@ -30,8 +30,8 @@ import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.TreeSet;
 
+import org.apache.felix.dm.Logger;
 import org.apache.felix.dm.PropertyMetaData;
-import org.apache.felix.dm.impl.Logger;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 import org.osgi.service.cm.ConfigurationException;

Modified: felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/test/test/SerialExecutorTest.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/test/test/SerialExecutorTest.java?rev=1656039&r1=1656038&r2=1656039&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/test/test/SerialExecutorTest.java (original)
+++ felix/sandbox/pderop/dependencymanager/org.apache.felix.dependencymanager/test/test/SerialExecutorTest.java Fri Jan 30 15:48:23 2015
@@ -25,7 +25,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.felix.dm.impl.Logger;
+import org.apache.felix.dm.Logger;
 import org.apache.felix.dm.impl.SerialExecutor;
 import org.junit.Assert;
 import org.junit.Test;



Mime
View raw message