1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Remove warnings from the core test plugin

This commit is contained in:
David Daoust 2006-07-06 17:59:13 +00:00
parent 7706ce1070
commit c0faa8cedc
14 changed files with 27 additions and 28 deletions

View file

@ -32,7 +32,6 @@ import org.eclipse.cdt.core.model.IInclude;
import org.eclipse.cdt.core.model.IMacro; import org.eclipse.cdt.core.model.IMacro;
import org.eclipse.cdt.core.model.IMethod; import org.eclipse.cdt.core.model.IMethod;
import org.eclipse.cdt.core.model.IMethodDeclaration; import org.eclipse.cdt.core.model.IMethodDeclaration;
import org.eclipse.cdt.core.model.IMethodTemplate;
import org.eclipse.cdt.core.model.IMethodTemplateDeclaration; import org.eclipse.cdt.core.model.IMethodTemplateDeclaration;
import org.eclipse.cdt.core.model.INamespace; import org.eclipse.cdt.core.model.INamespace;
import org.eclipse.cdt.core.model.IParent; import org.eclipse.cdt.core.model.IParent;

View file

@ -28,7 +28,7 @@ import org.eclipse.core.runtime.CoreException;
*/ */
public class CModelExceptionTest extends TestCase { public class CModelExceptionTest extends TestCase {
// Shared values setup and torn down // Shared values setup and torn down
private Throwable throwableException; // private Throwable throwableException;
private CModelStatus cModelStatus; private CModelStatus cModelStatus;
private CoreException coreException; private CoreException coreException;

View file

@ -18,6 +18,7 @@ import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCProjectNature; import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CProjectNature;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.ICProject; import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.testplugin.CProjectHelper; import org.eclipse.cdt.core.testplugin.CProjectHelper;
@ -124,7 +125,7 @@ public class CModelTests extends TestCase {
assertTrue("hasCCNature works", (CoreModel.hasCCNature(testProject.getProject()))); assertTrue("hasCCNature works", (CoreModel.hasCCNature(testProject.getProject())));
CCProjectNature.removeCCNature(testProject.getProject(), monitor); CCProjectNature.removeCCNature(testProject.getProject(), monitor);
CCProjectNature.removeCNature(testProject.getProject(), monitor); CProjectNature.removeCNature(testProject.getProject(), monitor);
assertTrue("hasCNature works without cnature", !CoreModel.hasCNature(testProject.getProject())); assertTrue("hasCNature works without cnature", !CoreModel.hasCNature(testProject.getProject()));
assertTrue("hasCCNature works without ccnature or cnature", !(CoreModel.hasCCNature(testProject.getProject()))); assertTrue("hasCCNature works without ccnature or cnature", !(CoreModel.hasCCNature(testProject.getProject())));
try{ try{

View file

@ -15,6 +15,7 @@
package org.eclipse.cdt.core.model.tests; package org.eclipse.cdt.core.model.tests;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.IMacro; import org.eclipse.cdt.core.model.IMacro;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
@ -66,7 +67,7 @@ public class IMacroTests extends IntegratedCModelTest {
public void testGetElementName() throws CModelException { public void testGetElementName() throws CModelException {
ITranslationUnit tu = getTU(); ITranslationUnit tu = getTU();
List arrayElements = tu.getChildrenOfType( ITranslationUnit.C_MACRO ); List arrayElements = tu.getChildrenOfType( ICElement.C_MACRO );
String expectedList[] = new String[] { String expectedList[] = new String[] {
"SINGLETON", "SINGLETON",
@ -83,7 +84,7 @@ public class IMacroTests extends IntegratedCModelTest {
public void testGetIdentifierList() throws CModelException { public void testGetIdentifierList() throws CModelException {
ITranslationUnit tu = getTU(); ITranslationUnit tu = getTU();
List arrayElements = tu.getChildrenOfType( ITranslationUnit.C_MACRO ); List arrayElements = tu.getChildrenOfType( ICElement.C_MACRO );
String expectedList[] = new String[] { String expectedList[] = new String[] {
"", "",
@ -100,7 +101,7 @@ public class IMacroTests extends IntegratedCModelTest {
public void testGetTokenSequence() throws CModelException { public void testGetTokenSequence() throws CModelException {
ITranslationUnit tu = getTU(); ITranslationUnit tu = getTU();
List arrayElements = tu.getChildrenOfType( ITranslationUnit.C_MACRO ); List arrayElements = tu.getChildrenOfType( ICElement.C_MACRO );
String expectedList[] = new String[] { String expectedList[] = new String[] {
"", "",

View file

@ -77,14 +77,14 @@ public abstract class AutomatedFramework extends TestCase {
filePath.endsWith(".C") || //$NON-NLS-1$ filePath.endsWith(".C") || //$NON-NLS-1$
filePath.endsWith(".hxx") || filePath.endsWith(".hh") ) //$NON-NLS-1$ //$NON-NLS-2$ filePath.endsWith(".hxx") || filePath.endsWith(".hh") ) //$NON-NLS-1$ //$NON-NLS-2$
{ {
AutomatedTest.natures.put( filePath, "cpp" ); //$NON-NLS-1$ AutomatedFramework.natures.put( filePath, "cpp" ); //$NON-NLS-1$
} else if( filePath.endsWith(".c") ){ //$NON-NLS-1$ } else if( filePath.endsWith(".c") ){ //$NON-NLS-1$
AutomatedTest.natures.put( filePath, "c" ); //$NON-NLS-1$ AutomatedFramework.natures.put( filePath, "c" ); //$NON-NLS-1$
} else { } else {
AutomatedTest.natures.put( filePath, AutomatedTest.defaultNature ); AutomatedFramework.natures.put( filePath, AutomatedFramework.defaultNature );
} }
AutomatedTest.fileList.add( file ); AutomatedFramework.fileList.add( file );
suite.addTest( newTest( file.getName().replace(',', '_') ) ); suite.addTest( newTest( file.getName().replace(',', '_') ) );
} }
file = files[ i++ ]; file = files[ i++ ];

View file

@ -74,18 +74,18 @@ public class CompleteParseASTSymbolIteratorTest extends CompleteParseBaseTest {
} }
} }
protected CompilationUnitCallback callback; protected CompilationUnitCallback localCallback;
protected IASTScope parse(String code, boolean throwOnError, ParserLanguage language) throws ParserException, ParserFactoryError protected IASTScope parse(String code, boolean throwOnError, ParserLanguage language) throws ParserException, ParserFactoryError
{ {
callback = new CompilationUnitCallback(); localCallback = new CompilationUnitCallback();
IParser parser = ParserFactory.createParser( IParser parser = ParserFactory.createParser(
ParserFactory.createScanner( new CodeReader(code.toCharArray()), new ScannerInfo(), ParserFactory.createScanner( new CodeReader(code.toCharArray()), new ScannerInfo(),
ParserMode.COMPLETE_PARSE, language, callback, new NullLogService(), null ), callback, ParserMode.COMPLETE_PARSE, language, null ParserMode.COMPLETE_PARSE, language, localCallback, new NullLogService(), null ), localCallback, ParserMode.COMPLETE_PARSE, language, null
); );
if( ! parser.parse() && throwOnError ) throw new ParserException( "FAILURE"); //$NON-NLS-1$ if( ! parser.parse() && throwOnError ) throw new ParserException( "FAILURE"); //$NON-NLS-1$
return callback.getCompilationUnit(); return localCallback.getCompilationUnit();
} }
protected Iterator getDeclarations(IASTScope scope) protected Iterator getDeclarations(IASTScope scope)

View file

@ -916,7 +916,7 @@ public class CompleteParseASTTemplateTest extends CompleteParseBaseTest {
IASTTemplateDeclaration spec2 = (IASTTemplateDeclaration) i.next(); IASTTemplateDeclaration spec2 = (IASTTemplateDeclaration) i.next();
IASTMethod f1 = (IASTMethod) spec1.getOwnedDeclaration(); IASTMethod f1 = (IASTMethod) spec1.getOwnedDeclaration();
IASTMethod f2 = (IASTMethod) spec2.getOwnedDeclaration();; IASTMethod f2 = (IASTMethod) spec2.getOwnedDeclaration();
IASTFunction main = (IASTFunction) i.next(); IASTFunction main = (IASTFunction) i.next();
assertFalse( i.hasNext() ); assertFalse( i.hasNext() );

View file

@ -21,7 +21,6 @@ import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTUtil; import org.eclipse.cdt.core.parser.ast.ASTUtil;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassReference;
@ -2228,7 +2227,7 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
Writer writer = new StringWriter(); Writer writer = new StringWriter();
writer.write( "class Thrown { };\n"); //$NON-NLS-1$ writer.write( "class Thrown { };\n"); //$NON-NLS-1$
writer.write( "void foo() throw( Thrown );"); //$NON-NLS-1$ writer.write( "void foo() throw( Thrown );"); //$NON-NLS-1$
Iterator i = (Iterator) parse( writer.toString() ).getDeclarations(); Iterator i = parse( writer.toString() ).getDeclarations();
assertTrue( i.next() instanceof IASTAbstractTypeSpecifierDeclaration ); assertTrue( i.next() instanceof IASTAbstractTypeSpecifierDeclaration );
IASTFunction foo = (IASTFunction) i.next(); IASTFunction foo = (IASTFunction) i.next();
assertFalse( i.hasNext() ); assertFalse( i.hasNext() );
@ -2344,7 +2343,7 @@ public class CompleteParseASTTest extends CompleteParseBaseTest
IASTFunction foo = (IASTFunction) i.next(); IASTFunction foo = (IASTFunction) i.next();
Iterator parms = foo.getParameters(); Iterator parms = foo.getParameters();
IASTParameterDeclaration blank = (IASTParameterDeclaration)parms.next(); IASTParameterDeclaration blank = (IASTParameterDeclaration)parms.next();
assertEquals( ASTUtil.getType( (IASTAbstractDeclaration)blank ), "volatile int&" ); //$NON-NLS-1$ assertEquals( ASTUtil.getType( blank ), "volatile int&" ); //$NON-NLS-1$
} }

View file

@ -113,7 +113,7 @@ public class ScannerParserLoopTest extends FileBasePluginTest {
private static class TimeoutCallback extends NullSourceElementRequestor private static class TimeoutCallback extends NullSourceElementRequestor
implements ISourceElementRequestor { implements ISourceElementRequestor {
private IParser parser; private IParser parser;
private boolean timerStarted = false; // private boolean timerStarted = false;
public void setParser(IParser parser) { public void setParser(IParser parser) {
this.parser = parser; this.parser = parser;

View file

@ -238,7 +238,7 @@ public class TortureTest extends FractionalAutomatedTest {
if (isExpectedToPass(testCode, file)) { if (isExpectedToPass(testCode, file)) {
ParseThread thread = new ParseThread(); ParseThread thread = new ParseThread();
thread.quickParse = quickParse; thread.quickParseFlag = quickParse;
thread.code = testCode; thread.code = testCode;
thread.cppNature = nature.equalsIgnoreCase("cpp"); //$NON-NLS-1$ thread.cppNature = nature.equalsIgnoreCase("cpp"); //$NON-NLS-1$
thread.file = filePath; thread.file = filePath;
@ -269,11 +269,11 @@ public class TortureTest extends FractionalAutomatedTest {
public String file; public String file;
public Throwable result = null; public Throwable result = null;
public IParser parser = null; public IParser parser = null;
public boolean quickParse = true; public boolean quickParseFlag = true;
public void run(){ public void run(){
try { try {
ParserMode parserMode = quickParse ? ParserMode.QUICK_PARSE : ParserMode.COMPLETE_PARSE; ParserMode parserMode = quickParseFlag ? ParserMode.QUICK_PARSE : ParserMode.COMPLETE_PARSE;
ParserLanguage language = cppNature ? ParserLanguage.CPP : ParserLanguage.C; ParserLanguage language = cppNature ? ParserLanguage.CPP : ParserLanguage.C;
parser = ParserFactory.createParser( parser = ParserFactory.createParser(
ParserFactory.createScanner( new CodeReader( code.toCharArray() ), new ScannerInfo(), parserMode, language, nullCallback, new NullLogService(), null ), nullCallback, parserMode, language, null); ParserFactory.createScanner( new CodeReader( code.toCharArray() ), new ScannerInfo(), parserMode, language, nullCallback, new NullLogService(), null ), nullCallback, parserMode, language, null);

View file

@ -113,13 +113,13 @@ public class XMLDumper {
Method method = null; Method method = null;
try { try {
method = cls.getMethod(methodName, null); method = cls.getMethod(methodName, (Class []) null);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
continue; continue;
} }
try { try {
value = method.invoke(obj, null); value = method.invoke(obj, (Object []) null);
} catch (Exception e) { } catch (Exception e) {
value = e; value = e;
} }

View file

@ -405,7 +405,7 @@ public static void endSplash() {
public static void main(String argString) throws Exception { public static void main(String argString) throws Exception {
Vector list = new Vector(5); Vector list = new Vector(5);
for (StringTokenizer tokens = new StringTokenizer(argString, " "); tokens.hasMoreElements();) for (StringTokenizer tokens = new StringTokenizer(argString, " "); tokens.hasMoreElements();)
list.addElement((String) tokens.nextElement()); list.addElement(tokens.nextElement());
main((String[]) list.toArray(new String[list.size()])); main((String[]) list.toArray(new String[list.size()]));
} }

View file

@ -53,7 +53,7 @@ public class NewMain extends Main {
public static void main(String argString) throws Exception { public static void main(String argString) throws Exception {
Vector list= new Vector(5); Vector list= new Vector(5);
for (StringTokenizer tokens= new StringTokenizer(argString, " "); tokens.hasMoreElements();) for (StringTokenizer tokens= new StringTokenizer(argString, " "); tokens.hasMoreElements();)
list.addElement((String) tokens.nextElement()); list.addElement(tokens.nextElement());
main((String[]) list.toArray(new String[list.size()])); main((String[]) list.toArray(new String[list.size()]));
} }

View file

@ -53,7 +53,6 @@ public class VerifyDialog extends TitleAreaDialog {
private Label _queryLabel; private Label _queryLabel;
Button _yesButton; Button _yesButton;
private Button _noButton;
private Button _checkList[]; private Button _checkList[];
private String _failureText; private String _failureText;
@ -84,7 +83,7 @@ public class VerifyDialog extends TitleAreaDialog {
*/ */
protected void createButtonsForButtonBar(Composite parent) { protected void createButtonsForButtonBar(Composite parent) {
_yesButton = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true); _yesButton = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
_noButton = createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false); createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
} }
/* (non-Javadoc) /* (non-Javadoc)
* Method declared on Dialog. * Method declared on Dialog.