mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +02:00
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>
This commit is contained in:
parent
835288f558
commit
26bef5d321
6 changed files with 29 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2008, 2009 QNX Software Systems and others.
|
* Copyright (c) 2008, 2015 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - initial API and implementation
|
* QNX Software Systems - initial API and implementation
|
||||||
* Ericsson - Update for DSF
|
* Ericsson - Update for DSF
|
||||||
|
* Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.gdb.launching;
|
package org.eclipse.cdt.dsf.gdb.launching;
|
||||||
|
|
||||||
|
@ -31,11 +32,11 @@ public class LaunchMessages {
|
||||||
private LaunchMessages() {}
|
private LaunchMessages() {}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String arg) {
|
public static String getFormattedString(String key, String arg) {
|
||||||
return MessageFormat.format(getString(key), new String[]{arg});
|
return MessageFormat.format(getString(key), arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFormattedString(String key, String[] args) {
|
public static String getFormattedString(String key, String[] args) {
|
||||||
return MessageFormat.format(getString(key), args);
|
return MessageFormat.format(getString(key), (Object[])args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString(String key) {
|
public static String getString(String key) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012, 2014 Mentor Graphics and others.
|
* Copyright (c) 2012, 2015 Mentor Graphics and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,6 +10,7 @@
|
||||||
* Salvatore Culcasi (ST) - Bug 407163 - GDB Console: breakpoint not added with MinGW and gdb
|
* Salvatore Culcasi (ST) - Bug 407163 - GDB Console: breakpoint not added with MinGW and gdb
|
||||||
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
|
* Marc Khouzam (Ericsson) - Update breakpoint handling for GDB >= 7.4 (Bug 389945)
|
||||||
* Marc Khouzam (Ericsson) - Support for dynamic printf (Bug 400628)
|
* Marc Khouzam (Ericsson) - Support for dynamic printf (Bug 400628)
|
||||||
|
* Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.dsf.mi.service;
|
package org.eclipse.cdt.dsf.mi.service;
|
||||||
|
@ -737,6 +738,8 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
return createPlatformAddressDynamicPrintf(fileName, miBpt);
|
return createPlatformAddressDynamicPrintf(fileName, miBpt);
|
||||||
}
|
}
|
||||||
// TODO This is currently causing problems because we think a normal dprintf is a function one
|
// TODO This is currently causing problems because we think a normal dprintf is a function one
|
||||||
|
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=400628#c16 which says:
|
||||||
|
// "synchronization of function dprintf does not work"
|
||||||
// else if (isFunctionBreakpoint(miBpt)) {
|
// else if (isFunctionBreakpoint(miBpt)) {
|
||||||
// return createPlatformFunctionDynamicPrintf(fileName, miBpt);
|
// return createPlatformFunctionDynamicPrintf(fileName, miBpt);
|
||||||
// }
|
// }
|
||||||
|
@ -774,6 +777,8 @@ public class MIBreakpointsSynchronizer extends AbstractDsfService implements IMI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unused, see TODO in createPlatformDynamicPrintf and Bug 400628 Comment 16
|
||||||
|
@SuppressWarnings("unused")
|
||||||
private ICBreakpoint createPlatformFunctionDynamicPrintf(String fileName, MIBreakpoint miBpt) throws CoreException {
|
private ICBreakpoint createPlatformFunctionDynamicPrintf(String fileName, MIBreakpoint miBpt) throws CoreException {
|
||||||
IResource resource = getResource(fileName);
|
IResource resource = getResource(fileName);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2012 Wind River Systems and others.
|
* Copyright (c) 2006, 2015 Wind River Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -12,6 +12,7 @@
|
||||||
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
|
* Onur Akdemir (TUBITAK BILGEM-ITI) - Multi-process debugging (Bug 237306)
|
||||||
* Marc Khouzam (Ericsson) - New method to properly created ErrorThread (Bug 350837)
|
* Marc Khouzam (Ericsson) - New method to properly created ErrorThread (Bug 350837)
|
||||||
* Jason Litton (Sage Electronic Engineering, LLC) - Use Dynamic Tracing option (Bug 379169)
|
* Jason Litton (Sage Electronic Engineering, LLC) - Use Dynamic Tracing option (Bug 379169)
|
||||||
|
* Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.mi.service.command;
|
package org.eclipse.cdt.dsf.mi.service.command;
|
||||||
|
|
||||||
|
@ -819,7 +820,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
clientMsg.append("Error message from debugger back end:\n"); //$NON-NLS-1$
|
clientMsg.append("Error message from debugger back end:\n"); //$NON-NLS-1$
|
||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
try {
|
try {
|
||||||
clientMsg.append(MessageFormat.format(message, parameters));
|
clientMsg.append(MessageFormat.format(message, (Object[])parameters));
|
||||||
} catch(IllegalArgumentException e2) {
|
} catch(IllegalArgumentException e2) {
|
||||||
// Message format string invalid. Fallback to just appending the strings.
|
// Message format string invalid. Fallback to just appending the strings.
|
||||||
clientMsg.append(message);
|
clientMsg.append(message);
|
||||||
|
@ -870,7 +871,7 @@ public abstract class AbstractMIControl extends AbstractDsfService
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
try {
|
try {
|
||||||
clientMsg.append(MessageFormat.format(message, parameters));
|
clientMsg.append(MessageFormat.format(message, (Object[])parameters));
|
||||||
} catch(IllegalArgumentException e2) {
|
} catch(IllegalArgumentException e2) {
|
||||||
// Message format string invalid. Fallback to just appending the strings.
|
// Message format string invalid. Fallback to just appending the strings.
|
||||||
clientMsg.append(message);
|
clientMsg.append(message);
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.datamodel;
|
package org.eclipse.cdt.dsf.datamodel;
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ public class CompositeDMContext implements IDMContext {
|
||||||
* @see #getSessionId()
|
* @see #getSessionId()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapterType) {
|
public <T> T getAdapter(Class<T> adapterType) {
|
||||||
IDMContext[] parents = getParents();
|
IDMContext[] parents = getParents();
|
||||||
if (parents.length > 0) {
|
if (parents.length > 0) {
|
||||||
return parents[0].getAdapter(adapterType);
|
return parents[0].getAdapter(adapterType);
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.service;
|
package org.eclipse.cdt.dsf.service;
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ abstract public class AbstractDsfService
|
||||||
private int fStartupNumber;
|
private int fStartupNumber;
|
||||||
|
|
||||||
/** Registration object for this service. */
|
/** Registration object for this service. */
|
||||||
private ServiceRegistration fRegistration;
|
private ServiceRegistration<?> fRegistration;
|
||||||
|
|
||||||
/** Tracker for services that this service depends on. */
|
/** Tracker for services that this service depends on. */
|
||||||
private DsfServicesTracker fTracker;
|
private DsfServicesTracker fTracker;
|
||||||
|
@ -264,5 +265,5 @@ abstract public class AbstractDsfService
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the registration object that was obtained when this service was registered */
|
/** Returns the registration object that was obtained when this service was registered */
|
||||||
protected ServiceRegistration getServiceRegistration() { return fRegistration; }
|
protected ServiceRegistration<?> getServiceRegistration() { return fRegistration; }
|
||||||
}
|
}
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
|
* Jonah Graham (Kichwa Coders) - Bug 317173 - cleanup warnings
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.service;
|
package org.eclipse.cdt.dsf.service;
|
||||||
|
|
||||||
|
@ -90,8 +91,8 @@ public class DsfServicesTracker {
|
||||||
private final String fSessionId;
|
private final String fSessionId;
|
||||||
private volatile boolean fDisposed = false;
|
private volatile boolean fDisposed = false;
|
||||||
private final BundleContext fBundleContext;
|
private final BundleContext fBundleContext;
|
||||||
private final Map<ServiceKey,ServiceReference> fServiceReferences = new HashMap<ServiceKey,ServiceReference>();
|
private final Map<ServiceKey,ServiceReference<?>> fServiceReferences = new HashMap<ServiceKey,ServiceReference<?>>();
|
||||||
private final Map<ServiceReference,Object> fServices = new HashMap<ServiceReference,Object>();
|
private final Map<ServiceReference<?>,Object> fServices = new HashMap<ServiceReference<?>,Object>();
|
||||||
private final String fServiceFilter;
|
private final String fServiceFilter;
|
||||||
|
|
||||||
private final ServiceListener fListner = new ServiceListener() {
|
private final ServiceListener fListner = new ServiceListener() {
|
||||||
|
@ -127,8 +128,8 @@ public class DsfServicesTracker {
|
||||||
};
|
};
|
||||||
|
|
||||||
private void handleUnregisterEvent(ServiceEvent event) {
|
private void handleUnregisterEvent(ServiceEvent event) {
|
||||||
for (Iterator<Map.Entry<ServiceKey, ServiceReference>> itr = fServiceReferences.entrySet().iterator(); itr.hasNext();) {
|
for (Iterator<Map.Entry<ServiceKey, ServiceReference<?>>> itr = fServiceReferences.entrySet().iterator(); itr.hasNext();) {
|
||||||
Map.Entry<ServiceKey, ServiceReference> entry = itr.next();
|
Map.Entry<ServiceKey, ServiceReference<?>> entry = itr.next();
|
||||||
if ( entry.getValue().equals(event.getServiceReference()) ) {
|
if ( entry.getValue().equals(event.getServiceReference()) ) {
|
||||||
itr.remove();
|
itr.remove();
|
||||||
}
|
}
|
||||||
|
@ -221,7 +222,7 @@ public class DsfServicesTracker {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <V> V getService(Class<V> serviceClass, String filter) {
|
public <V> V getService(Class<V> serviceClass, String filter) {
|
||||||
ServiceReference serviceRef = getServiceReference(serviceClass, filter);
|
ServiceReference<?> serviceRef = getServiceReference(serviceClass, filter);
|
||||||
if (serviceRef == null) {
|
if (serviceRef == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
@ -270,7 +271,7 @@ public class DsfServicesTracker {
|
||||||
private void doDispose() {
|
private void doDispose() {
|
||||||
try {
|
try {
|
||||||
fBundleContext.removeServiceListener(fListner);
|
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());
|
fBundleContext.ungetService(itr.next());
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue