1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Generified getAdapter method.

This commit is contained in:
Sergey Prigogin 2015-04-15 11:42:01 -07:00
parent 2335e8b93b
commit 30b6492de1
2 changed files with 7 additions and 7 deletions

View file

@ -10,12 +10,10 @@
*******************************************************************************/
package org.eclipse.cdt.core.parser.tests.scanner;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.dom.parser.c.GCCScannerExtensionConfiguration;
import org.eclipse.cdt.core.parser.FileContent;
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.IncludeFileContentProvider;
import org.eclipse.cdt.core.parser.NullLogService;
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
import org.eclipse.cdt.core.parser.ParserLanguage;
@ -28,6 +26,8 @@ import org.eclipse.cdt.internal.core.parser.scanner.MacroExpander;
import org.eclipse.cdt.internal.core.parser.scanner.MacroExpansionTracker;
import org.eclipse.text.edits.ReplaceEdit;
import junit.framework.TestSuite;
public class ExpansionExplorerTests extends BaseTestCase {
@ -90,7 +90,7 @@ public class ExpansionExplorerTests extends BaseTestCase {
do {
type= cpp.nextTokenRaw().getType();
} while (type != IToken.tEND_OF_INPUT);
return (MacroExpander) cpp.getAdapter(MacroExpander.class);
return cpp.getAdapter(MacroExpander.class);
}
// #define A

View file

@ -1954,10 +1954,10 @@ public class CPreprocessor implements ILexerLog, IScanner, IAdaptable {
}
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public Object getAdapter(Class adapter) {
@SuppressWarnings("unchecked")
public <T> T getAdapter(Class<T> adapter) {
if (adapter.isAssignableFrom(fMacroExpander.getClass())) {
return fMacroExpander;
return (T) fMacroExpander;
}
return null;
}