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:05:52 -04:00
parent 30b6492de1
commit 3f8305fc0f
2 changed files with 8 additions and 6 deletions

View file

@ -634,7 +634,7 @@ public class MIRegistersTest extends BaseTestCase {
}
@Override
public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) {
public <T> T getAdapter(Class<T> adapter) {
return null;
}
};

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -31,7 +31,9 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationCont
import org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.jface.viewers.TreePath;
import static org.junit.Assert.*;
import org.osgi.framework.BundleContext;
/**
@ -93,11 +95,11 @@ public class TestModel extends AbstractDsfService implements IFormattedValues {
return fModel;
}
@SuppressWarnings("rawtypes")
@SuppressWarnings("unchecked")
@Override
public Object getAdapter(Class adapter) {
public <T> T getAdapter(Class<T> adapter) {
if (adapter.isInstance(fModel)) {
return fModel;
return (T)fModel;
}
return null;
}