1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +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. * session is equally important.
* @see org.eclipse.runtime.IAdapterManager * @see org.eclipse.runtime.IAdapterManager
*/ */
@SuppressWarnings("unchecked")
@Override @Override
@SuppressWarnings("rawtypes") public <T> T getAdapter(Class<T> adapterType) {
public Object getAdapter(Class adapterType) { T retVal = (T)fSession.getModelAdapter(adapterType);
Object retVal = fSession.getModelAdapter(adapterType);
if (retVal == null) { if (retVal == null) {
retVal = super.getAdapter(adapterType); 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 * 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
@ -26,9 +26,9 @@ import org.eclipse.debug.core.model.IMemoryBlockRetrieval;
*/ */
public class MemoryBlockRetrievalFactory implements IAdapterFactory { public class MemoryBlockRetrievalFactory implements IAdapterFactory {
@SuppressWarnings("rawtypes") @SuppressWarnings("unchecked")
@Override @Override
public Object getAdapter(Object adaptableObject, Class adapterType) { public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
IMemoryBlockRetrieval memRetrieval = null; IMemoryBlockRetrieval memRetrieval = null;
if (adaptableObject instanceof IDMContext) { if (adaptableObject instanceof IDMContext) {
@ -44,12 +44,11 @@ public class MemoryBlockRetrievalFactory implements IAdapterFactory {
} }
} }
return memRetrieval; return (T)memRetrieval;
} }
@SuppressWarnings("rawtypes")
@Override @Override
public Class[] getAdapterList() { public Class<?>[] getAdapterList() {
return new Class[] { IMemoryBlockRetrieval.class }; return new Class[] { IMemoryBlockRetrieval.class };
} }
} }