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

Fix warnings.

This commit is contained in:
Markus Schorn 2008-04-10 11:58:41 +00:00
parent 772a60e5b6
commit 3c104b3f4c
10 changed files with 37 additions and 51 deletions

View file

@ -20,7 +20,6 @@ import junit.framework.TestSuite;
*/ */
public class AstWriterTestSuite{ public class AstWriterTestSuite{
@SuppressWarnings("nls")
public static Test suite() throws Exception { public static Test suite() throws Exception {
TestSuite suite = new TestSuite("AstWriterTests"); TestSuite suite = new TestSuite("AstWriterTests");
suite.addTest(SourceRewriteTester.suite("ExpressionTests", "resources/rewrite/ASTWriterExpressionTestSource.awts")); suite.addTest(SourceRewriteTester.suite("ExpressionTests", "resources/rewrite/ASTWriterExpressionTestSource.awts"));

View file

@ -25,7 +25,6 @@ import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace.Replace
*/ */
public class ChangeGeneratorTestSuite{ public class ChangeGeneratorTestSuite{
@SuppressWarnings("nls")
public static Test suite() throws Exception { public static Test suite() throws Exception {
TestSuite suite = new TestSuite("ChangeGeneratorTests"); TestSuite suite = new TestSuite("ChangeGeneratorTests");

View file

@ -20,7 +20,6 @@ import junit.framework.TestSuite;
*/ */
public class AppendTestSuite{ public class AppendTestSuite{
@SuppressWarnings("nls")
public static Test suite() throws Exception { public static Test suite() throws Exception {
TestSuite suite = new TestSuite("Changegenerator Append Child Tests"); TestSuite suite = new TestSuite("Changegenerator Append Child Tests");

View file

@ -20,7 +20,6 @@ import junit.framework.TestSuite;
*/ */
public class InsertBeforeTestSuite{ public class InsertBeforeTestSuite{
@SuppressWarnings("nls")
public static Test suite() throws Exception { public static Test suite() throws Exception {
TestSuite suite = new TestSuite("Changegenerator InsertBefore Tests"); TestSuite suite = new TestSuite("Changegenerator InsertBefore Tests");

View file

@ -20,7 +20,6 @@ import junit.framework.TestSuite;
*/ */
public class RemoveTestSuite{ public class RemoveTestSuite{
@SuppressWarnings("nls")
public static Test suite() throws Exception { public static Test suite() throws Exception {
TestSuite suite = new TestSuite("Changegenerator Remove Tests"); TestSuite suite = new TestSuite("Changegenerator Remove Tests");

View file

@ -20,7 +20,6 @@ import junit.framework.TestSuite;
*/ */
public class ReplaceTestSuite{ public class ReplaceTestSuite{
@SuppressWarnings("nls")
public static Test suite() throws Exception { public static Test suite() throws Exception {
TestSuite suite = new TestSuite("ChangegeneratorReplaceTests"); TestSuite suite = new TestSuite("ChangegeneratorReplaceTests");

View file

@ -550,8 +550,7 @@ public class CVisitor {
if( scope != null && scope instanceof ICFunctionScope ){ if( scope != null && scope instanceof ICFunctionScope ){
CFunctionScope functionScope = (CFunctionScope) scope; CFunctionScope functionScope = (CFunctionScope) scope;
ILabel [] labels = functionScope.getLabels(); ILabel [] labels = functionScope.getLabels();
for( int i = 0; i < labels.length; i++ ){ for (ILabel label : labels) {
ILabel label = labels[i];
if( CharArrayUtils.equals( label.getNameCharArray(), gotoName) ){ if( CharArrayUtils.equals( label.getNameCharArray(), gotoName) ){
return label; return label;
} }
@ -639,9 +638,9 @@ public class CVisitor {
try { try {
char [] p = fieldReference.getFieldName().toCharArray(); char [] p = fieldReference.getFieldName().toCharArray();
IField [] fields = ((ICompositeType) type).getFields(); IField [] fields = ((ICompositeType) type).getFields();
for ( int i = 0; i < fields.length; i++ ) { for (IField field : fields) {
if( CharArrayUtils.equals( fields[i].getNameCharArray(), 0, p.length, p, true ) ){ if( CharArrayUtils.equals( field.getNameCharArray(), 0, p.length, p, true ) ){
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, fields[i] ); result = (IBinding[]) ArrayUtil.append( IBinding.class, result, field );
} }
} }
return ArrayUtil.trim( IBinding.class, result ); return ArrayUtil.trim( IBinding.class, result );
@ -1391,8 +1390,8 @@ public class CVisitor {
if( prefixMap != null ){ if( prefixMap != null ){
IBinding [] result = null; IBinding [] result = null;
Object [] vals = prefixMap.valueArray(); Object [] vals = prefixMap.valueArray();
for ( int i = 0; i < vals.length; i++ ) { for (Object val : vals) {
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, ((IASTName) vals[i]).resolveBinding() ); result = (IBinding[]) ArrayUtil.append( IBinding.class, result, ((IASTName) val).resolveBinding() );
} }
IASTTranslationUnit tu = (IASTTranslationUnit)blockItem; IASTTranslationUnit tu = (IASTTranslationUnit)blockItem;
@ -1472,9 +1471,9 @@ public class CVisitor {
} }
//also have to check for any nested structs //also have to check for any nested structs
IASTDeclaration [] nested = ((ICASTCompositeTypeSpecifier)declSpec).getMembers(); IASTDeclaration [] nested = ((ICASTCompositeTypeSpecifier)declSpec).getMembers();
for( int i = 0; i < nested.length; i++ ){ for (IASTDeclaration element : nested) {
if( nested[i] instanceof IASTSimpleDeclaration ){ if( element instanceof IASTSimpleDeclaration ){
IASTDeclSpecifier d = ((IASTSimpleDeclaration)nested[i]).getDeclSpecifier(); IASTDeclSpecifier d = ((IASTSimpleDeclaration)element).getDeclSpecifier();
if( d instanceof ICASTCompositeTypeSpecifier || d instanceof IASTEnumerationSpecifier ) { if( d instanceof ICASTCompositeTypeSpecifier || d instanceof IASTEnumerationSpecifier ) {
Object obj = checkForBinding( scope, d, name, typesOnly, prefixMap ); Object obj = checkForBinding( scope, d, name, typesOnly, prefixMap );
if( prefixMap == null && resultName == null ){ if( prefixMap == null && resultName == null ){
@ -1496,8 +1495,7 @@ public class CVisitor {
} }
//check enumerators //check enumerators
IASTEnumerator [] list = ((ICASTEnumerationSpecifier) declSpec).getEnumerators(); IASTEnumerator [] list = ((ICASTEnumerationSpecifier) declSpec).getEnumerators();
for( int i = 0; i < list.length; i++ ) { for (IASTEnumerator enumerator : list) {
IASTEnumerator enumerator = list[i];
if( enumerator == null ) break; if( enumerator == null ) break;
tempName = enumerator.getName(); tempName = enumerator.getName();
if( scope != null ) if( scope != null )
@ -1573,8 +1571,7 @@ public class CVisitor {
if( declaration instanceof IASTSimpleDeclaration ){ if( declaration instanceof IASTSimpleDeclaration ){
IASTSimpleDeclaration simpleDeclaration = (IASTSimpleDeclaration) declaration; IASTSimpleDeclaration simpleDeclaration = (IASTSimpleDeclaration) declaration;
IASTDeclarator [] declarators = simpleDeclaration.getDeclarators(); IASTDeclarator [] declarators = simpleDeclaration.getDeclarators();
for( int i = 0; i < declarators.length; i++ ){ for (IASTDeclarator declarator : declarators) {
IASTDeclarator declarator = declarators[i];
while( declarator.getNestedDeclarator() != null ){ while( declarator.getNestedDeclarator() != null ){
declarator = declarator.getNestedDeclarator(); declarator = declarator.getNestedDeclarator();
} }
@ -1641,8 +1638,7 @@ public class CVisitor {
} }
boolean begun = ( beginAtLoc == AT_BEGINNING ); boolean begun = ( beginAtLoc == AT_BEGINNING );
if( list != null ){ if( list != null ){
for( int i = 0; i < list.length; i++ ){ for (IASTNode node : list) {
IASTNode node = list[i];
if( node == blockItem ){ if( node == blockItem ){
begun = true; begun = true;
continue; continue;
@ -1784,7 +1780,6 @@ public class CVisitor {
* @param declSpec the IASTDeclSpecifier used to determine if the base type is a CQualifierType or not * @param declSpec the IASTDeclSpecifier used to determine if the base type is a CQualifierType or not
* @return the base IType * @return the base IType
*/ */
@SuppressWarnings("null")
public static IType createBaseType( IASTDeclSpecifier declSpec ) { public static IType createBaseType( IASTDeclSpecifier declSpec ) {
if( declSpec instanceof IGCCASTSimpleDeclSpecifier ){ if( declSpec instanceof IGCCASTSimpleDeclSpecifier ){
IASTExpression exp = ((IGCCASTSimpleDeclSpecifier)declSpec).getTypeofExpression(); IASTExpression exp = ((IGCCASTSimpleDeclSpecifier)declSpec).getTypeofExpression();
@ -1804,6 +1799,8 @@ public class CVisitor {
name = ((IASTCompositeTypeSpecifier) declSpec).getName(); name = ((IASTCompositeTypeSpecifier) declSpec).getName();
} else if( declSpec instanceof IASTEnumerationSpecifier ){ } else if( declSpec instanceof IASTEnumerationSpecifier ){
name = ((IASTEnumerationSpecifier)declSpec).getName(); name = ((IASTEnumerationSpecifier)declSpec).getName();
} else {
return new ProblemBinding(declSpec, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, declSpec.getRawSignature().toCharArray() );
} }
binding = name.resolveBinding(); binding = name.resolveBinding();
@ -1860,9 +1857,9 @@ public class CVisitor {
continue; continue;
IASTDeclarator [] dtors = ((IASTSimpleDeclaration)decls[i]).getDeclarators(); IASTDeclarator [] dtors = ((IASTSimpleDeclaration)decls[i]).getDeclarators();
for( int j = 0; j < dtors.length; j++ ){ for (IASTDeclarator dtor : dtors) {
if( CharArrayUtils.equals( dtors[j].getName().toCharArray(), n ) ){ if( CharArrayUtils.equals( dtor.getName().toCharArray(), n ) ){
return dtors[j]; return dtor;
} }
} }
} }
@ -2051,8 +2048,7 @@ public class CVisitor {
char [] n = name.toCharArray(); char [] n = name.toCharArray();
if( scope instanceof ICFunctionScope ){ if( scope instanceof ICFunctionScope ){
ILabel [] labels = ((CFunctionScope)scope).getLabels(); ILabel [] labels = ((CFunctionScope)scope).getLabels();
for( int i = 0; i < labels.length; i++ ){ for (ILabel label : labels) {
ILabel label = labels[i];
if (prefixLookup) { if (prefixLookup) {
if (CharArrayUtils.equals(label.getNameCharArray(), if (CharArrayUtils.equals(label.getNameCharArray(),
0, n.length, n, true)) { 0, n.length, n, true)) {

View file

@ -516,8 +516,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
IScope tuScope = translationUnit.getScope(); IScope tuScope = translationUnit.getScope();
IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope); IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope);
for(int i=0; i<bindings.length; i++) { for (IBinding binding : bindings) {
ASTInternal.addBinding(tuScope, bindings[i]); ASTInternal.addBinding(tuScope, binding);
} }
} }
} catch (Exception e2) { } catch (Exception e2) {
@ -1667,12 +1667,12 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
declaration = ((IASTSimpleDeclaration) decl); declaration = ((IASTSimpleDeclaration) decl);
IASTDeclarator[] decltors = declaration.getDeclarators(); IASTDeclarator[] decltors = declaration.getDeclarators();
for (int k = 0; k < decltors.length; k++) { for (IASTDeclarator decltor : decltors) {
boolean decltorOk = false; boolean decltorOk = false;
for (int j = 0; j < parmNames.length; j++) { for (IASTName parmName : parmNames) {
if (CharArrayUtils.equals( if (CharArrayUtils.equals(
decltors[k].getName().toCharArray(), decltor.getName().toCharArray(),
parmNames[j].toCharArray())) { parmName.toCharArray())) {
decltorOk = true; decltorOk = true;
break; break;
} }
@ -1855,7 +1855,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
return new CASTDeclarator(); return new CASTDeclarator();
} }
@SuppressWarnings("fallthrough")
protected void consumeArrayModifiers(List<IASTNode> arrayMods) protected void consumeArrayModifiers(List<IASTNode> arrayMods)
throws EndOfFileException, BacktrackException { throws EndOfFileException, BacktrackException {
@ -1890,7 +1889,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
case IToken.tSTAR: case IToken.tSTAR:
isVarSized = true; isVarSized = true;
consume(); consume();
// deliberate fall through break outerLoop;
default: default:
break outerLoop; break outerLoop;
} }

View file

@ -742,22 +742,20 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
throwExpression, throwToken.getOffset(), o); // fix for 95225 throwExpression, throwToken.getOffset(), o); // fix for 95225
} }
@SuppressWarnings("fallthrough")
@Override @Override
protected IASTExpression relationalExpression() throws BacktrackException, EndOfFileException { protected IASTExpression relationalExpression() throws BacktrackException, EndOfFileException {
IASTExpression firstExpression = shiftExpression(); IASTExpression firstExpression = shiftExpression();
for (;;) { for (;;) {
switch (LT(1)) { final int lt1 = LT(1);
switch (lt1) {
case IToken.tGT: case IToken.tGT:
if (templateIdScopes.size() > 0
&& templateIdScopes.peek() == IToken.tLT) {
return firstExpression;
}
// fall through
case IToken.tLT: case IToken.tLT:
case IToken.tLTEQUAL: case IToken.tLTEQUAL:
case IToken.tGTEQUAL: case IToken.tGTEQUAL:
if (lt1 == IToken.tGT && templateIdScopes.size() > 0 && templateIdScopes.peek() == IToken.tLT)
return firstExpression;
IToken m = mark(); IToken m = mark();
int t = consume().getType(); int t = consume().getType();
@ -791,7 +789,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (supportMinAndMaxOperators if (supportMinAndMaxOperators
&& (LT(1) == IGCCToken.tMIN || LT(1) == IGCCToken.tMAX)) { && (LT(1) == IGCCToken.tMIN || LT(1) == IGCCToken.tMAX)) {
int new_operator = 0; int new_operator = 0;
switch (LT(1)) { switch (lt1) {
case IGCCToken.tMAX: case IGCCToken.tMAX:
consume(); consume();
new_operator = IGPPASTBinaryExpression.op_max; new_operator = IGPPASTBinaryExpression.op_max;
@ -2492,8 +2490,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
// as a work around just flatten them. // as a work around just flatten them.
if (subName instanceof ICPPASTQualifiedName) { if (subName instanceof ICPPASTQualifiedName) {
IASTName[] subNames= ((ICPPASTQualifiedName) subName).getNames(); IASTName[] subNames= ((ICPPASTQualifiedName) subName).getNames();
for (int j = 0; j < subNames.length; j++) { for (IASTName subName2 : subNames) {
subName = subNames[j]; subName = subName2;
result.addName(subName); result.addName(subName);
} }
} }
@ -4188,8 +4186,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
IScope tuScope = translationUnit.getScope(); IScope tuScope = translationUnit.getScope();
IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope); IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope);
for(int i=0; i<bindings.length; i++) { for (IBinding binding : bindings) {
ASTInternal.addBinding(tuScope, bindings[i]); ASTInternal.addBinding(tuScope, binding);
} }
} }
} catch (Exception e2) { } catch (Exception e2) {

View file

@ -127,10 +127,9 @@ final class CompletionProposalComputerDescriptor {
* @param element the configuration element to read * @param element the configuration element to read
* @param registry the computer registry creating this descriptor * @param registry the computer registry creating this descriptor
*/ */
@SuppressWarnings("null")
CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List<CompletionProposalCategory> categories) throws InvalidRegistryObjectException { CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List<CompletionProposalCategory> categories) throws InvalidRegistryObjectException {
Assert.isLegal(registry != null); Assert.isNotNull(registry);
Assert.isLegal(element != null); Assert.isNotNull(element);
fRegistry= registry; fRegistry= registry;
fElement= element; fElement= element;