diff options
author | Jonah Graham | 2015-06-11 13:13:55 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-06-11 14:53:35 +0000 |
commit | 26bef5d3212c24dca5fc5ff0816728f59c247bbf (patch) | |
tree | d9340b3027d4508a2a1e22be6aec61f414f4ad39 /dsf/org.eclipse.cdt.dsf/src | |
parent | 835288f5587ab27df135f0bcb87890dd0942d534 (diff) | |
download | org.eclipse.cdt-26bef5d3212c24dca5fc5ff0816728f59c247bbf.tar.gz org.eclipse.cdt-26bef5d3212c24dca5fc5ff0816728f59c247bbf.tar.xz org.eclipse.cdt-26bef5d3212c24dca5fc5ff0816728f59c247bbf.zip |
Bug 317173 - cleanup warnings
- Add generics for ServiceRegistration and ServiceReference
(added <?>), See Bug 322007 which added generics to OSGI
- Add generics for getAdapter, See Bug Bug 442021
- Fix calls to MessageFormat.format()
- Cross reference some unused/commented out code for dprintf with
associated @SuppressWarnings("unused")
Change-Id: I4bacb3b37b69c97ab35615413f0f1f3e71aa2092
Signed-off-by: Jonah Graham <jonah@kichwacoders.com>
Diffstat (limited to 'dsf/org.eclipse.cdt.dsf/src')
3 files changed, 15 insertions, 12 deletions
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/CompositeDMContext.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/CompositeDMContext.java index c2a2b4d5357..c0f26c7df59 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/CompositeDMContext.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/CompositeDMContext.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2009 Wind River Systems and others. + * Copyright (c) 2007, 2015 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Wind River Systems - initial API and implementation + * Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings *******************************************************************************/ package org.eclipse.cdt.dsf.datamodel; @@ -75,7 +76,7 @@ public class CompositeDMContext implements IDMContext { * @see #getSessionId() */ @Override - public Object getAdapter(Class adapterType) { + public <T> T getAdapter(Class<T> adapterType) { IDMContext[] parents = getParents(); if (parents.length > 0) { return parents[0].getAdapter(adapterType); diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java index c8c08072686..7c1a458b325 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/AbstractDsfService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2010 Wind River Systems and others. + * Copyright (c) 2006, 2015 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Wind River Systems - initial API and implementation + * Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings *******************************************************************************/ package org.eclipse.cdt.dsf.service; @@ -41,7 +42,7 @@ abstract public class AbstractDsfService private int fStartupNumber; /** Registration object for this service. */ - private ServiceRegistration fRegistration; + private ServiceRegistration<?> fRegistration; /** Tracker for services that this service depends on. */ private DsfServicesTracker fTracker; @@ -264,5 +265,5 @@ abstract public class AbstractDsfService } /** Returns the registration object that was obtained when this service was registered */ - protected ServiceRegistration getServiceRegistration() { return fRegistration; } + protected ServiceRegistration<?> getServiceRegistration() { return fRegistration; } }
\ No newline at end of file diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfServicesTracker.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfServicesTracker.java index 18b28162ce0..23906b0dcdf 100644 --- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfServicesTracker.java +++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/service/DsfServicesTracker.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 Wind River Systems and others. + * Copyright (c) 2009, 2015 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Wind River Systems - initial API and implementation + * Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings *******************************************************************************/ package org.eclipse.cdt.dsf.service; @@ -90,8 +91,8 @@ public class DsfServicesTracker { private final String fSessionId; private volatile boolean fDisposed = false; private final BundleContext fBundleContext; - private final Map<ServiceKey,ServiceReference> fServiceReferences = new HashMap<ServiceKey,ServiceReference>(); - private final Map<ServiceReference,Object> fServices = new HashMap<ServiceReference,Object>(); + private final Map<ServiceKey,ServiceReference<?>> fServiceReferences = new HashMap<ServiceKey,ServiceReference<?>>(); + private final Map<ServiceReference<?>,Object> fServices = new HashMap<ServiceReference<?>,Object>(); private final String fServiceFilter; private final ServiceListener fListner = new ServiceListener() { @@ -127,8 +128,8 @@ public class DsfServicesTracker { }; private void handleUnregisterEvent(ServiceEvent event) { - for (Iterator<Map.Entry<ServiceKey, ServiceReference>> itr = fServiceReferences.entrySet().iterator(); itr.hasNext();) { - Map.Entry<ServiceKey, ServiceReference> entry = itr.next(); + for (Iterator<Map.Entry<ServiceKey, ServiceReference<?>>> itr = fServiceReferences.entrySet().iterator(); itr.hasNext();) { + Map.Entry<ServiceKey, ServiceReference<?>> entry = itr.next(); if ( entry.getValue().equals(event.getServiceReference()) ) { itr.remove(); } @@ -221,7 +222,7 @@ public class DsfServicesTracker { */ @SuppressWarnings("unchecked") public <V> V getService(Class<V> serviceClass, String filter) { - ServiceReference serviceRef = getServiceReference(serviceClass, filter); + ServiceReference<?> serviceRef = getServiceReference(serviceClass, filter); if (serviceRef == null) { return null; } else { @@ -270,7 +271,7 @@ public class DsfServicesTracker { private void doDispose() { try { fBundleContext.removeServiceListener(fListner); - for (Iterator<ServiceReference> itr = fServices.keySet().iterator(); itr.hasNext();) { + for (Iterator<ServiceReference<?>> itr = fServices.keySet().iterator(); itr.hasNext();) { fBundleContext.ungetService(itr.next()); } } catch (IllegalStateException e) { |