Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarkus Schorn2008-04-10 11:58:41 +0000
committerMarkus Schorn2008-04-10 11:58:41 +0000
commit3c104b3f4c70dbd30b6129567fe3e17ade0b0b9c (patch)
tree85b363528fb4ff45e5bb3da47d2531001800fc62 /core
parent772a60e5b64e324d8abfb15eaa9cab969f41e77b (diff)
downloadorg.eclipse.cdt-3c104b3f4c70dbd30b6129567fe3e17ade0b0b9c.tar.gz
org.eclipse.cdt-3c104b3f4c70dbd30b6129567fe3e17ade0b0b9c.tar.xz
org.eclipse.cdt-3c104b3f4c70dbd30b6129567fe3e17ade0b0b9c.zip
Fix warnings.
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/AstWriterTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/append/AppendTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/RemoveTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java40
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java15
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java22
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java5
10 files changed, 37 insertions, 51 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/AstWriterTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/AstWriterTestSuite.java
index 65d0aef7877..01542deb9d4 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/AstWriterTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/astwriter/AstWriterTestSuite.java
@@ -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"));
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTestSuite.java
index c8c10fa2f61..f3027d9eb7c 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/ChangeGeneratorTestSuite.java
@@ -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");
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/append/AppendTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/append/AppendTestSuite.java
index cf83f3b256d..f4cce8ff6e7 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/append/AppendTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/append/AppendTestSuite.java
@@ -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");
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java
index f4520988731..659b221861a 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/insertbefore/InsertBeforeTestSuite.java
@@ -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");
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/RemoveTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/RemoveTestSuite.java
index b124b80d030..be547e43068 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/RemoveTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/remove/RemoveTestSuite.java
@@ -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");
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceTestSuite.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceTestSuite.java
index 08fb3b5c4c2..6c4f52b4d4e 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceTestSuite.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/rewrite/changegenerator/replace/ReplaceTestSuite.java
@@ -20,7 +20,6 @@ import junit.framework.TestSuite;
*/
public class ReplaceTestSuite{
- @SuppressWarnings("nls")
public static Test suite() throws Exception {
TestSuite suite = new TestSuite("ChangegeneratorReplaceTests");
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
index 19067ffb96e..03abd908a69 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CVisitor.java
@@ -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)) {
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
index d3ac738eb7f..9ad332ff5f9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
@@ -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;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index c5d39af6f23..8167cbba2d0 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -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) {
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
index 987e8976c10..024d32a00cc 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/contentassist/CompletionProposalComputerDescriptor.java
@@ -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;

Back to the top