mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Fix warnings.
This commit is contained in:
parent
772a60e5b6
commit
3c104b3f4c
10 changed files with 37 additions and 51 deletions
|
@ -20,7 +20,6 @@ import junit.framework.TestSuite;
|
|||
*/
|
||||
public class AstWriterTestSuite{
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("AstWriterTests");
|
||||
suite.addTest(SourceRewriteTester.suite("ExpressionTests", "resources/rewrite/ASTWriterExpressionTestSource.awts"));
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.eclipse.cdt.core.parser.tests.rewrite.changegenerator.replace.Replace
|
|||
*/
|
||||
public class ChangeGeneratorTestSuite{
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("ChangeGeneratorTests");
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import junit.framework.TestSuite;
|
|||
*/
|
||||
public class AppendTestSuite{
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("Changegenerator Append Child Tests");
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import junit.framework.TestSuite;
|
|||
*/
|
||||
public class InsertBeforeTestSuite{
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("Changegenerator InsertBefore Tests");
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import junit.framework.TestSuite;
|
|||
*/
|
||||
public class RemoveTestSuite{
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("Changegenerator Remove Tests");
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import junit.framework.TestSuite;
|
|||
*/
|
||||
public class ReplaceTestSuite{
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public static Test suite() throws Exception {
|
||||
TestSuite suite = new TestSuite("ChangegeneratorReplaceTests");
|
||||
|
||||
|
|
|
@ -550,8 +550,7 @@ public class CVisitor {
|
|||
if( scope != null && scope instanceof ICFunctionScope ){
|
||||
CFunctionScope functionScope = (CFunctionScope) scope;
|
||||
ILabel [] labels = functionScope.getLabels();
|
||||
for( int i = 0; i < labels.length; i++ ){
|
||||
ILabel label = labels[i];
|
||||
for (ILabel label : labels) {
|
||||
if( CharArrayUtils.equals( label.getNameCharArray(), gotoName) ){
|
||||
return label;
|
||||
}
|
||||
|
@ -639,9 +638,9 @@ public class CVisitor {
|
|||
try {
|
||||
char [] p = fieldReference.getFieldName().toCharArray();
|
||||
IField [] fields = ((ICompositeType) type).getFields();
|
||||
for ( int i = 0; i < fields.length; i++ ) {
|
||||
if( CharArrayUtils.equals( fields[i].getNameCharArray(), 0, p.length, p, true ) ){
|
||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, fields[i] );
|
||||
for (IField field : fields) {
|
||||
if( CharArrayUtils.equals( field.getNameCharArray(), 0, p.length, p, true ) ){
|
||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, field );
|
||||
}
|
||||
}
|
||||
return ArrayUtil.trim( IBinding.class, result );
|
||||
|
@ -1391,8 +1390,8 @@ public class CVisitor {
|
|||
if( prefixMap != null ){
|
||||
IBinding [] result = null;
|
||||
Object [] vals = prefixMap.valueArray();
|
||||
for ( int i = 0; i < vals.length; i++ ) {
|
||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, ((IASTName) vals[i]).resolveBinding() );
|
||||
for (Object val : vals) {
|
||||
result = (IBinding[]) ArrayUtil.append( IBinding.class, result, ((IASTName) val).resolveBinding() );
|
||||
}
|
||||
|
||||
IASTTranslationUnit tu = (IASTTranslationUnit)blockItem;
|
||||
|
@ -1472,9 +1471,9 @@ public class CVisitor {
|
|||
}
|
||||
//also have to check for any nested structs
|
||||
IASTDeclaration [] nested = ((ICASTCompositeTypeSpecifier)declSpec).getMembers();
|
||||
for( int i = 0; i < nested.length; i++ ){
|
||||
if( nested[i] instanceof IASTSimpleDeclaration ){
|
||||
IASTDeclSpecifier d = ((IASTSimpleDeclaration)nested[i]).getDeclSpecifier();
|
||||
for (IASTDeclaration element : nested) {
|
||||
if( element instanceof IASTSimpleDeclaration ){
|
||||
IASTDeclSpecifier d = ((IASTSimpleDeclaration)element).getDeclSpecifier();
|
||||
if( d instanceof ICASTCompositeTypeSpecifier || d instanceof IASTEnumerationSpecifier ) {
|
||||
Object obj = checkForBinding( scope, d, name, typesOnly, prefixMap );
|
||||
if( prefixMap == null && resultName == null ){
|
||||
|
@ -1496,8 +1495,7 @@ public class CVisitor {
|
|||
}
|
||||
//check enumerators
|
||||
IASTEnumerator [] list = ((ICASTEnumerationSpecifier) declSpec).getEnumerators();
|
||||
for( int i = 0; i < list.length; i++ ) {
|
||||
IASTEnumerator enumerator = list[i];
|
||||
for (IASTEnumerator enumerator : list) {
|
||||
if( enumerator == null ) break;
|
||||
tempName = enumerator.getName();
|
||||
if( scope != null )
|
||||
|
@ -1573,8 +1571,7 @@ public class CVisitor {
|
|||
if( declaration instanceof IASTSimpleDeclaration ){
|
||||
IASTSimpleDeclaration simpleDeclaration = (IASTSimpleDeclaration) declaration;
|
||||
IASTDeclarator [] declarators = simpleDeclaration.getDeclarators();
|
||||
for( int i = 0; i < declarators.length; i++ ){
|
||||
IASTDeclarator declarator = declarators[i];
|
||||
for (IASTDeclarator declarator : declarators) {
|
||||
while( declarator.getNestedDeclarator() != null ){
|
||||
declarator = declarator.getNestedDeclarator();
|
||||
}
|
||||
|
@ -1641,8 +1638,7 @@ public class CVisitor {
|
|||
}
|
||||
boolean begun = ( beginAtLoc == AT_BEGINNING );
|
||||
if( list != null ){
|
||||
for( int i = 0; i < list.length; i++ ){
|
||||
IASTNode node = list[i];
|
||||
for (IASTNode node : list) {
|
||||
if( node == blockItem ){
|
||||
begun = true;
|
||||
continue;
|
||||
|
@ -1784,7 +1780,6 @@ public class CVisitor {
|
|||
* @param declSpec the IASTDeclSpecifier used to determine if the base type is a CQualifierType or not
|
||||
* @return the base IType
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
public static IType createBaseType( IASTDeclSpecifier declSpec ) {
|
||||
if( declSpec instanceof IGCCASTSimpleDeclSpecifier ){
|
||||
IASTExpression exp = ((IGCCASTSimpleDeclSpecifier)declSpec).getTypeofExpression();
|
||||
|
@ -1804,6 +1799,8 @@ public class CVisitor {
|
|||
name = ((IASTCompositeTypeSpecifier) declSpec).getName();
|
||||
} else if( declSpec instanceof IASTEnumerationSpecifier ){
|
||||
name = ((IASTEnumerationSpecifier)declSpec).getName();
|
||||
} else {
|
||||
return new ProblemBinding(declSpec, IProblemBinding.SEMANTIC_NAME_NOT_FOUND, declSpec.getRawSignature().toCharArray() );
|
||||
}
|
||||
|
||||
binding = name.resolveBinding();
|
||||
|
@ -1860,9 +1857,9 @@ public class CVisitor {
|
|||
continue;
|
||||
|
||||
IASTDeclarator [] dtors = ((IASTSimpleDeclaration)decls[i]).getDeclarators();
|
||||
for( int j = 0; j < dtors.length; j++ ){
|
||||
if( CharArrayUtils.equals( dtors[j].getName().toCharArray(), n ) ){
|
||||
return dtors[j];
|
||||
for (IASTDeclarator dtor : dtors) {
|
||||
if( CharArrayUtils.equals( dtor.getName().toCharArray(), n ) ){
|
||||
return dtor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2051,8 +2048,7 @@ public class CVisitor {
|
|||
char [] n = name.toCharArray();
|
||||
if( scope instanceof ICFunctionScope ){
|
||||
ILabel [] labels = ((CFunctionScope)scope).getLabels();
|
||||
for( int i = 0; i < labels.length; i++ ){
|
||||
ILabel label = labels[i];
|
||||
for (ILabel label : labels) {
|
||||
if (prefixLookup) {
|
||||
if (CharArrayUtils.equals(label.getNameCharArray(),
|
||||
0, n.length, n, true)) {
|
||||
|
|
|
@ -516,8 +516,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IScope tuScope = translationUnit.getScope();
|
||||
|
||||
IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope);
|
||||
for(int i=0; i<bindings.length; i++) {
|
||||
ASTInternal.addBinding(tuScope, bindings[i]);
|
||||
for (IBinding binding : bindings) {
|
||||
ASTInternal.addBinding(tuScope, binding);
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
|
@ -1667,12 +1667,12 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
declaration = ((IASTSimpleDeclaration) decl);
|
||||
|
||||
IASTDeclarator[] decltors = declaration.getDeclarators();
|
||||
for (int k = 0; k < decltors.length; k++) {
|
||||
for (IASTDeclarator decltor : decltors) {
|
||||
boolean decltorOk = false;
|
||||
for (int j = 0; j < parmNames.length; j++) {
|
||||
for (IASTName parmName : parmNames) {
|
||||
if (CharArrayUtils.equals(
|
||||
decltors[k].getName().toCharArray(),
|
||||
parmNames[j].toCharArray())) {
|
||||
decltor.getName().toCharArray(),
|
||||
parmName.toCharArray())) {
|
||||
decltorOk = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1855,7 +1855,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
return new CASTDeclarator();
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
protected void consumeArrayModifiers(List<IASTNode> arrayMods)
|
||||
throws EndOfFileException, BacktrackException {
|
||||
|
||||
|
@ -1890,7 +1889,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
case IToken.tSTAR:
|
||||
isVarSized = true;
|
||||
consume();
|
||||
// deliberate fall through
|
||||
break outerLoop;
|
||||
default:
|
||||
break outerLoop;
|
||||
}
|
||||
|
|
|
@ -742,22 +742,20 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
throwExpression, throwToken.getOffset(), o); // fix for 95225
|
||||
}
|
||||
|
||||
@SuppressWarnings("fallthrough")
|
||||
@Override
|
||||
protected IASTExpression relationalExpression() throws BacktrackException, EndOfFileException {
|
||||
|
||||
IASTExpression firstExpression = shiftExpression();
|
||||
for (;;) {
|
||||
switch (LT(1)) {
|
||||
final int lt1 = LT(1);
|
||||
switch (lt1) {
|
||||
case IToken.tGT:
|
||||
if (templateIdScopes.size() > 0
|
||||
&& templateIdScopes.peek() == IToken.tLT) {
|
||||
return firstExpression;
|
||||
}
|
||||
// fall through
|
||||
case IToken.tLT:
|
||||
case IToken.tLTEQUAL:
|
||||
case IToken.tGTEQUAL:
|
||||
if (lt1 == IToken.tGT && templateIdScopes.size() > 0 && templateIdScopes.peek() == IToken.tLT)
|
||||
return firstExpression;
|
||||
|
||||
IToken m = mark();
|
||||
int t = consume().getType();
|
||||
|
||||
|
@ -791,7 +789,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
if (supportMinAndMaxOperators
|
||||
&& (LT(1) == IGCCToken.tMIN || LT(1) == IGCCToken.tMAX)) {
|
||||
int new_operator = 0;
|
||||
switch (LT(1)) {
|
||||
switch (lt1) {
|
||||
case IGCCToken.tMAX:
|
||||
consume();
|
||||
new_operator = IGPPASTBinaryExpression.op_max;
|
||||
|
@ -2492,8 +2490,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
// as a work around just flatten them.
|
||||
if (subName instanceof ICPPASTQualifiedName) {
|
||||
IASTName[] subNames= ((ICPPASTQualifiedName) subName).getNames();
|
||||
for (int j = 0; j < subNames.length; j++) {
|
||||
subName = subNames[j];
|
||||
for (IASTName subName2 : subNames) {
|
||||
subName = subName2;
|
||||
result.addName(subName);
|
||||
}
|
||||
}
|
||||
|
@ -4188,8 +4186,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IScope tuScope = translationUnit.getScope();
|
||||
|
||||
IBinding[] bindings = builtinBindingsProvider.getBuiltinBindings(tuScope);
|
||||
for(int i=0; i<bindings.length; i++) {
|
||||
ASTInternal.addBinding(tuScope, bindings[i]);
|
||||
for (IBinding binding : bindings) {
|
||||
ASTInternal.addBinding(tuScope, binding);
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
|
|
|
@ -127,10 +127,9 @@ final class CompletionProposalComputerDescriptor {
|
|||
* @param element the configuration element to read
|
||||
* @param registry the computer registry creating this descriptor
|
||||
*/
|
||||
@SuppressWarnings("null")
|
||||
CompletionProposalComputerDescriptor(IConfigurationElement element, CompletionProposalComputerRegistry registry, List<CompletionProposalCategory> categories) throws InvalidRegistryObjectException {
|
||||
Assert.isLegal(registry != null);
|
||||
Assert.isLegal(element != null);
|
||||
Assert.isNotNull(registry);
|
||||
Assert.isNotNull(element);
|
||||
|
||||
fRegistry= registry;
|
||||
fElement= element;
|
||||
|
|
Loading…
Add table
Reference in a new issue