diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/command/CCommandAdapterFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/command/CCommandAdapterFactory.java index af79bbc18ed..8096f6aa7e8 100755 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/command/CCommandAdapterFactory.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/command/CCommandAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2012 IBM Corporation and others. + * Copyright (c) 2006, 2016 IBM Corporation 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 @@ -26,24 +26,19 @@ import org.eclipse.debug.core.commands.IRestartHandler; public class CCommandAdapterFactory implements IAdapterFactory { private static IRestartHandler fgRestartCommand = new RestartCommand(); - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Object adaptableObject, Class adapterType) { + public T getAdapter(Object adaptableObject, Class adapterType) { if (IRestartHandler.class.equals(adapterType)) { if (adaptableObject instanceof IRestart) { - return fgRestartCommand; + return (T) fgRestartCommand; } } return null; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ @Override - public Class[] getAdapterList() { + public Class[] getAdapterList() { return new Class[] { IRestartHandler.class }; diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/Executable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/Executable.java index 57b9854008a..d960327b17d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/Executable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/Executable.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2011 Nokia and others. + * Copyright (c) 2008, 2016 Nokia 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 @@ -156,14 +156,14 @@ public class Executable extends PlatformObject { return name; } - @SuppressWarnings("rawtypes") + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Class adapter) { + public T getAdapter(Class adapter) { if (adapter.equals(IResource.class)) if (getResource() != null) - return getResource(); + return (T) getResource(); else - return this.getProject(); + return (T) this.getProject(); return super.getAdapter(adapter); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java index 3b571eeb2f9..20b81b2ea0e 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/DebugModelProvider.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012 Wind River Systems and others. + * Copyright (c) 2012, 2016 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 @@ -19,10 +19,9 @@ import org.eclipse.debug.core.model.IDebugModelProvider; * Debug model provider returns additional model ID to use with * GDB event breakpoints. */ -@SuppressWarnings("rawtypes") public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory { - private final static Class[] ADAPTER_LIST = new Class[] { IDebugModelProvider.class }; + private final static Class[] ADAPTER_LIST = new Class[] { IDebugModelProvider.class }; private final static String GDB_MODEL_ID = "org.eclipse.cdt.gdb"; //$NON-NLS-1$ private final static String[] MODEL_IDS = new String[] { CDIDebugModel.getPluginIdentifier(), GDB_MODEL_ID }; @@ -31,16 +30,17 @@ public class DebugModelProvider implements IDebugModelProvider, IAdapterFactory return MODEL_IDS; } - @Override - public Object getAdapter(Object adaptableObject, Class adapterType) { + @SuppressWarnings("unchecked") + @Override + public T getAdapter(Object adaptableObject, Class adapterType) { if ( adaptableObject instanceof ICDebugElement && IDebugModelProvider.class.equals(adapterType) ) { - return this; + return (T) this; } return null; } @Override - public Class[] getAdapterList() { + public Class[] getAdapterList() { return ADAPTER_LIST; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/disassembly/DisassemblyContextService.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/disassembly/DisassemblyContextService.java index 5f1d1a9b0f7..9089c7fca07 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/disassembly/DisassemblyContextService.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/disassembly/DisassemblyContextService.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2012 ARM Limited and others. + * Copyright (c) 2008, 2016 ARM Limited 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 @@ -20,56 +20,44 @@ import org.eclipse.core.runtime.ListenerList; public class DisassemblyContextService implements IDisassemblyContextService { - private ListenerList fListeners; + private ListenerList fListeners; private Set fContexts; public DisassemblyContextService() { fContexts = new CopyOnWriteArraySet(); - fListeners = new ListenerList(); + fListeners = new ListenerList<>(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#addDisassemblyContextListener(org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextListener) - */ @Override public void addDisassemblyContextListener( IDisassemblyContextListener listener ) { fListeners.add( listener ); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#removeDisassemblyContextListener(org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextListener) - */ @Override public void removeDisassemblyContextListener( IDisassemblyContextListener listener ) { fListeners.remove( listener ); } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#register(java.lang.Object) - */ @Override public void register( Object context ) { fContexts.add( context ); - for( Object listener : fListeners.getListeners() ) { - ((IDisassemblyContextListener)listener).contextAdded( context ); + for( IDisassemblyContextListener listener : fListeners) { + listener.contextAdded( context ); } } - /* (non-Javadoc) - * @see org.eclipse.cdt.debug.core.disassembly.IDisassemblyContextService#unregister(java.lang.Object) - */ @Override public void unregister( Object context ) { fContexts.remove( context ); - for( Object listener : fListeners.getListeners() ) { - ((IDisassemblyContextListener)listener).contextRemoved( context ); + for( IDisassemblyContextListener listener : fListeners) { + listener.contextRemoved( context ); } } public void dispose() { for( Object context : fContexts ) { - for( Object listener : fListeners.getListeners() ) { - ((IDisassemblyContextListener)listener).contextRemoved( context ); + for( IDisassemblyContextListener listener : fListeners) { + listener.contextRemoved( context ); } } fListeners.clear(); diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java index a39dbc8e58a..0ec9087683f 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CDirectorySourceLocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. + * Copyright (c) 2000, 2016 QNX Software 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 @@ -107,17 +107,15 @@ public class CDirectorySourceLocation implements IDirectorySourceLocation { return result; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + public T getAdapter(Class adapter) { if (adapter.equals(ICSourceLocation.class)) - return this; + return (T) this; if (adapter.equals(CDirectorySourceLocation.class)) - return this; + return (T) this; if (adapter.equals(IPath.class)) - return getDirectory(); + return (T) getDirectory(); return null; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java index 6b6b3bf596e..539438aeb7d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CProjectSourceLocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 QNX Software Systems and others. + * Copyright (c) 2000, 2016 QNX Software 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 @@ -98,17 +98,15 @@ public class CProjectSourceLocation implements IProjectSourceLocation { return result; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + public T getAdapter(Class adapter) { if (adapter.equals(ICSourceLocation.class)) - return this; + return (T) this; if (adapter.equals(CProjectSourceLocation.class)) - return this; + return (T) this; if (adapter.equals(IProject.class)) - return getProject(); + return (T) getProject(); return null; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java index 31c34841d96..9d98444f4a4 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/sourcelookup/CSourceManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2012 QNX Software Systems and others. + * Copyright (c) 2004, 2016 QNX Software 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 @@ -83,20 +83,17 @@ public class CSourceManager implements ICSourceLocator, IPersistableSourceLocato return (getCSourceLocator() != null) ? getCSourceLocator().contains(resource) : false; } - /* - * (non-Javadoc) - * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class) - */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { + public T getAdapter(Class adapter) { if (adapter.equals(CSourceManager.class)) - return this; + return (T) this; if (adapter.equals(ICSourceLocator.class)) - return this; + return (T) this; if (adapter.equals(IPersistableSourceLocator.class)) - return this; + return (T) this; if (adapter.equals(IResourceChangeListener.class) && fSourceLocator instanceof IResourceChangeListener) - return fSourceLocator; + return (T) fSourceLocator; return null; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/srcfinder/CSourceFinderFactory.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/srcfinder/CSourceFinderFactory.java index 003402d1e05..7b564892795 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/srcfinder/CSourceFinderFactory.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/srcfinder/CSourceFinderFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2012 Freescale Semiconductor and others. + * Copyright (c) 2010, 2016 Freescale Semiconductor 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 @@ -19,26 +19,19 @@ import org.eclipse.core.runtime.IAdapterFactory; */ public class CSourceFinderFactory implements IAdapterFactory { - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class) - */ + @SuppressWarnings("unchecked") @Override - @SuppressWarnings("rawtypes") - public Object getAdapter(Object adaptableObject, Class adapterType) { + public T getAdapter(Object adaptableObject, Class adapterType) { if (adaptableObject instanceof IBinary) { if (adapterType.equals(ISourceFinder.class)) { - return new CSourceFinder((IBinary)adaptableObject); + return (T) new CSourceFinder((IBinary)adaptableObject); } } return null; } - /* (non-Javadoc) - * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() - */ @Override - @SuppressWarnings("rawtypes") - public Class[] getAdapterList() { + public Class[] getAdapterList() { return new Class[] { ISourceFinder.class }; } }