1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 22:22:11 +02:00

Move to new getAdapter() signature using generics

Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2015-04-15 14:02:24 -04:00
parent 7c8b2459d5
commit 2335e8b93b
2 changed files with 9 additions and 10 deletions

View file

@ -136,10 +136,10 @@ abstract public class AbstractDMContext extends PlatformObject
* session is equally important.
* @see org.eclipse.runtime.IAdapterManager
*/
@SuppressWarnings("unchecked")
@Override
@SuppressWarnings("rawtypes")
public Object getAdapter(Class adapterType) {
Object retVal = fSession.getModelAdapter(adapterType);
public <T> T getAdapter(Class<T> adapterType) {
T retVal = (T)fSession.getModelAdapter(adapterType);
if (retVal == null) {
retVal = super.getAdapter(adapterType);
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2013 Ericsson and others.
* Copyright (c) 2013, 2015 Ericsson 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,9 +26,9 @@ import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
*/
public class MemoryBlockRetrievalFactory implements IAdapterFactory {
@SuppressWarnings("rawtypes")
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Object adaptableObject, Class adapterType) {
public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
IMemoryBlockRetrieval memRetrieval = null;
if (adaptableObject instanceof IDMContext) {
@ -44,12 +44,11 @@ public class MemoryBlockRetrievalFactory implements IAdapterFactory {
}
}
return memRetrieval;
return (T)memRetrieval;
}
@SuppressWarnings("rawtypes")
@Override
public Class[] getAdapterList() {
public Class<?>[] getAdapterList() {
return new Class[] { IMemoryBlockRetrieval.class };
}
}