Move to new getAdapter() signature using generics
authorMarc Khouzam <marc.khouzam@ericsson.com>
Wed, 15 Apr 2015 18:02:24 +0000 (14:02 -0400)
committerMarc Khouzam <marc.khouzam@ericsson.com>
Wed, 15 Apr 2015 18:02:24 +0000 (14:02 -0400)
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/datamodel/AbstractDMContext.java
dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/internal/provisional/model/MemoryBlockRetrievalFactory.java

index d9b36e9..620f655 100644 (file)
@@ -136,10 +136,10 @@ abstract public class AbstractDMContext extends PlatformObject
      * session is equally important. 
      * @see org.eclipse.runtime.IAdapterManager 
      */
-    @Override
-    @SuppressWarnings("rawtypes")
-    public Object getAdapter(Class adapterType) {
-        Object retVal = fSession.getModelAdapter(adapterType);
+    @SuppressWarnings("unchecked")
+       @Override
+    public <T> T getAdapter(Class<T> adapterType) {
+        T retVal = (T)fSession.getModelAdapter(adapterType);
         if (retVal == null) {
             retVal = super.getAdapter(adapterType);
         }
index 4bef5b6..6fe7492 100644 (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 };
        }
 }