diff options
author | Dani Megert | 2015-02-20 12:08:00 +0000 |
---|---|---|
committer | Dani Megert | 2015-02-20 12:08:00 +0000 |
commit | 035b16c4845dde58ab3f6463878cbe662349e58c (patch) | |
tree | a312725ef6ac6c4aeedc3ca81bad03b0583f5fb1 /org.eclipse.debug.core/core | |
parent | 87bf3db976790862ceb9b321661e0234afb342ca (diff) | |
download | eclipse.platform.debug-035b16c4845dde58ab3f6463878cbe662349e58c.tar.gz eclipse.platform.debug-035b16c4845dde58ab3f6463878cbe662349e58c.tar.xz eclipse.platform.debug-035b16c4845dde58ab3f6463878cbe662349e58c.zip |
Fixed bug 460417: Fix compiler problems from generified IAdaptable#getAdapter(..)
Diffstat (limited to 'org.eclipse.debug.core/core')
8 files changed, 50 insertions, 40 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java index 8f54e9cbb..1c0c8ccd9 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/Launch.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -19,6 +19,7 @@ import java.util.List; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.PlatformObject; + import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IDisconnect; import org.eclipse.debug.core.model.IProcess; @@ -584,14 +585,15 @@ public class Launch extends PlatformObject implements ILaunch, IDisconnect, ILau /* (non-Javadoc) * @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class) */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Class adapter) { + public <T> T getAdapter(Class<T> adapter) { if (adapter.equals(ILaunch.class)) { - return this; + return (T) this; } //CONTEXTLAUNCHING if(adapter.equals(ILaunchConfiguration.class)) { - return getLaunchConfiguration(); + return (T) getLaunchConfiguration(); } return super.getAdapter(adapter); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java index 71e606570..4f8fa16a2 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/DebugElement.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2013 IBM Corporation and others. + * Copyright (c) 2005, 2015 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 @@ -13,6 +13,7 @@ package org.eclipse.debug.core.model; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.Status; + import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -62,30 +63,31 @@ public abstract class DebugElement extends PlatformObject implements IDebugEleme /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ - @Override - public Object getAdapter(Class adapter) { + @SuppressWarnings("unchecked") + @Override + public <T> T getAdapter(Class<T> adapter) { if (adapter == IDebugElement.class) { - return this; + return (T) this; } // a debug target may not implement IStepFilters if (adapter == IStepFilters.class) { if (getDebugTarget() instanceof IStepFilters) { - return getDebugTarget(); + return (T) getDebugTarget(); } } if (adapter == IDebugTarget.class) { - return getDebugTarget(); + return (T) getDebugTarget(); } if (adapter == ILaunch.class) { - return getLaunch(); + return (T) getLaunch(); } if (adapter == IProcess.class) { - return getDebugTarget().getProcess(); + return (T) getDebugTarget().getProcess(); } //CONTEXTLAUNCHING if(adapter == ILaunchConfiguration.class) { - return getLaunch().getLaunchConfiguration(); + return (T) getLaunch().getLaunchConfiguration(); } return super.getAdapter(adapter); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java index 1a27397d2..df1929382 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/model/RuntimeProcess.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -18,6 +18,7 @@ import java.util.Map.Entry; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.PlatformObject; import org.eclipse.core.runtime.Status; + import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -345,27 +346,28 @@ public class RuntimeProcess extends PlatformObject implements IProcess { /* (non-Javadoc) * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Class adapter) { + public <T> T getAdapter(Class<T> adapter) { if (adapter.equals(IProcess.class)) { - return this; + return (T) this; } if (adapter.equals(IDebugTarget.class)) { ILaunch launch = getLaunch(); IDebugTarget[] targets = launch.getDebugTargets(); for (int i = 0; i < targets.length; i++) { if (this.equals(targets[i].getProcess())) { - return targets[i]; + return (T) targets[i]; } } return null; } if (adapter.equals(ILaunch.class)) { - return getLaunch(); + return (T) getLaunch(); } //CONTEXTLAUNCHING if(adapter.equals(ILaunchConfiguration.class)) { - return getLaunch().getLaunchConfiguration(); + return (T) getLaunch().getLaunchConfiguration(); } return super.getAdapter(adapter); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java index c72eb51af..1b28178e3 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/MemoryBlockManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2013 IBM Corporation and others. + * Copyright (c) 2004, 2015 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 @@ -242,7 +242,7 @@ public class MemoryBlockManager implements IMemoryBlockManager, IDebugEventSetLi } } else { - IMemoryBlockRetrieval mbRetrieval = (IMemoryBlockRetrieval) block.getAdapter(IMemoryBlockRetrieval.class); + IMemoryBlockRetrieval mbRetrieval = block.getAdapter(IMemoryBlockRetrieval.class); // standard memory block always uses the debug target as the memory block retrieval if (mbRetrieval == null) { mbRetrieval = block.getDebugTarget(); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java index c6aa374f0..443e98f10 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StepFilterManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -62,7 +62,7 @@ public class StepFilterManager implements ILaunchListener { */ @Override public void launchChanged(ILaunch launch) { - IStepFiltersHandler command = (IStepFiltersHandler)launch.getAdapter(IStepFiltersHandler.class); + IStepFiltersHandler command = launch.getAdapter(IStepFiltersHandler.class); if (command != null) { command.execute(new DebugCommandRequest(new Object[]{launch})); } diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java index b257db3cc..4adad0f18 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/WatchExpression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2013 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -11,6 +11,7 @@ package org.eclipse.debug.internal.core; import org.eclipse.core.runtime.Platform; + import org.eclipse.debug.core.DebugEvent; import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugPlugin; @@ -229,13 +230,14 @@ public class WatchExpression implements IWatchExpression { /** * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) */ + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Class adapter) { + public <T> T getAdapter(Class<T> adapter) { //CONTEXTLAUNCHING if(adapter.equals(ILaunchConfiguration.class)) { ILaunch launch = getLaunch(); if(launch != null) { - return launch.getLaunchConfiguration(); + return (T) launch.getLaunchConfiguration(); } } return Platform.getAdapterManager().getAdapter(this, adapter); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/CommandAdapterFactory.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/CommandAdapterFactory.java index ce7a82c2c..179ada39a 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/CommandAdapterFactory.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/CommandAdapterFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 IBM Corporation and others. + * Copyright (c) 2006, 2015 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 @@ -11,6 +11,7 @@ package org.eclipse.debug.internal.core.commands; import org.eclipse.core.runtime.IAdapterFactory; + import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.commands.IDisconnectHandler; import org.eclipse.debug.core.commands.IDropToFrameHandler; @@ -51,54 +52,55 @@ public class CommandAdapterFactory implements IAdapterFactory { /* (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> T getAdapter(Object adaptableObject, Class<T> adapterType) { if (IStepFiltersHandler.class.equals(adapterType)) { if (adaptableObject instanceof IDebugElement || adaptableObject instanceof ILaunch || adaptableObject instanceof IProcess) { - return fgStepFiltersCommand; + return (T) fgStepFiltersCommand; } } if (ITerminateHandler.class.equals(adapterType)) { if (adaptableObject instanceof ITerminate) { - return fgTerminateCommand; + return (T) fgTerminateCommand; } } if (IStepOverHandler.class.equals(adapterType)) { if (adaptableObject instanceof IStep) { - return fgStepOverCommand; + return (T) fgStepOverCommand; } } if (IStepIntoHandler.class.equals(adapterType)) { if (adaptableObject instanceof IStep) { - return fgStepIntoCommand; + return (T) fgStepIntoCommand; } } if (IStepReturnHandler.class.equals(adapterType)) { if (adaptableObject instanceof IStep) { - return fgStepReturnCommand; + return (T) fgStepReturnCommand; } } if (ISuspendHandler.class.equals(adapterType)) { if (adaptableObject instanceof ISuspendResume) { - return fgSuspendCommand; + return (T) fgSuspendCommand; } } if (IResumeHandler.class.equals(adapterType)) { if (adaptableObject instanceof ISuspendResume) { - return fgResumeCommand; + return (T) fgResumeCommand; } } if (IDisconnectHandler.class.equals(adapterType)) { if (adaptableObject instanceof IDisconnect) { - return fgDisconnectCommand; + return (T) fgDisconnectCommand; } } if (IDropToFrameHandler.class.equals(adapterType)) { if (adaptableObject instanceof IDropToFrame) { - return fgDropToFrameCommand; + return (T) fgDropToFrameCommand; } } return null; @@ -108,7 +110,7 @@ public class CommandAdapterFactory implements IAdapterFactory { * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() */ @Override - public Class[] getAdapterList() { + public Class<?>[] getAdapterList() { return new Class[]{ ITerminateHandler.class, IStepOverHandler.class, diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java index 147ec25b3..0cf2c6a58 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/commands/StepCommand.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 IBM Corporation and others. + * Copyright (c) 2006, 2015 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 @@ -67,7 +67,7 @@ public abstract class StepCommand extends AbstractDebugCommand { if (object instanceof IStackFrame) { frame = (IStackFrame) object; } else if (object instanceof IAdaptable) { - frame = (IStackFrame)((IAdaptable)object).getAdapter(IStackFrame.class); + frame = ((IAdaptable)object).getAdapter(IStackFrame.class); } if (frame != null) { if (!threads.add(frame.getThread())) { |